Wednesday, December 10, 2014

Displaying the first day of the week in CoolSigns content

The following javascript can be used to display the first day of the current week in content created for CoolSigns.

var d = new Date();
var day = d.getDay();
var diff = d.getDate() - day + (day == 0 ? -6:1);
var monday = new Date(d.setDate(diff));

var month = monday.getMonth() == 0 ? "January":
monday.getMonth() == 1 ? "February":
monday.getMonth() == 2 ? "March":
monday.getMonth() == 3 ? "April":
monday.getMonth() == 4 ? "May":
monday.getMonth() == 5 ? "June":
monday.getMonth() == 6 ? "July":
monday.getMonth() == 7 ? "August":
monday.getMonth() == 8 ? "September":
monday.getMonth() == 9 ? "October":
monday.getMonth() == 10 ? "November":"December";

return month + " " + monday.getDate() + ", " + monday.getYear();

Using an OR Statement in Crystal Reports to suppress rows in the Details section


I recently created a report where I want to suppress rows in the Details section of a Crystal Report. Using an OR statement along with a conditional IF, besides suppressing based on duplicate ID values, I can also suppress the row based upon a parameter value.

{?Intended Audience} = "Internal Use Only"
OR
 if (not onfirstrecord) then (previous({PERSON.ID})={PERSON.ID})

Thursday, September 11, 2014

Using PowerShell to find the GUID of an SPField instance

In SharePoint, I occasionally need to find the GUID of a field in a custom list. The following PowerShell will spit out the field's GUID:


$web=get-spweb https://mysite.com/mysite/
$list=$web.lists["My List Display Name"]
$list.fields["MyFieldName"].id

Wednesday, August 27, 2014

Looking for at least one checked checkbox in Multiple-Selection List Box groups using X-Path in InfoPath


In a scenario involving multiple groups of Multiple-Selection List Boxes where I needed to check and see if at least one checkbox was checked in an InfoPath form, I used a Calculated Field to display a message if no checkboxes were checked. Checking for at least one box checked can be accomplished by using the following X-Path expression:

substring("Text to show if no checkboxes selected", 1, (not(boolean(xdMath:Eval(dfs:dataFields/my:SharePointListItem_RW/my:ListBox1/Value[. != ""], "."))) and
not(boolean(xdMath:Eval(dfs:dataFields/my:SharePointListItem_RW/my:ListBox2/Value[. != ""], "."))) and
not(boolean(xdMath:Eval(dfs:dataFields/my:SharePointListItem_RW/my:ListBox3/Value[. != ""], ".")))) *
string-length("Text to show if no checkboxes selected"))

The condition evaluates to True (1) if no boxes are checked, False (0) if any box is checked. These 1 or 0 values are multiplied by the length of the text and serve as the third parameter in the substring function, determining the length of the substring.

Wednesday, July 2, 2014

Formatting datetime datafields in CoolSign Content Creator

 
When using the current datetime or Data table datetime values for digital signage content in Haivision's CoolSigns Content Creator software, the following DateTime string patterns can be used:
 
MM/dd/yyyy - 08/22/2014 
dddd, MMMM dd yyyy - Tuesday, July 01 2014 
dddd, MMMM d yyyy HH:mm - Tuesday, July 1 2014 06:30 
dddd, MMMM dd yyyy hh:mm tt - Tuesday, July 01 2014 06:30 AM 
dddd, MMMM d yyyy H:mm - Tuesday, July 1 2014 6:30 
dddd, MMMM dd yyyy h:mm tt - Tuesday, July 01 2014 6:30 AM
ddd, MMM d yyyy h:mm tt - Tues, Jul 1 2014 6:30 AM
dddd, MMMM d yyyy HH:mm:ss - Tuesday, July 1 2014 06:30:07 
MM/dd/yyyy HH:mm - 08/22/2014 06:30 
MM/dd/yyyy hh:mm tt - 08/22/2014 06:30 AM 
MM/dd/yyyy H:mm - 08/22/2014 6:30 
MM/dd/yyyy h:mm tt - 08/22/2014 6:30 AM  
MM/dd/yyyy HH:mm:ss - 08/22/2014 06:30:07


In the Expression builder, the following javascript syntax can be used to format the datetime value:

return FormatDateStr(GetValueEx("localstart",rowindex,timeoffset,""),"h:mm tt")

If - Else statement in CoolSigns Datafield Expression

When using Data tables to add dynamic data to digital signage content in Haivision's CoolSign Content Creator software, it's important to know that the Expression builder editor excepts most javascript syntax. If - Else statements are permitted, below is an example:

if (GetValueEx("location",rowindex,timeoffset,"").indexOf("Away") > -1)
      return "Away Game"
else
      return "Home Game"

This example checks the value of "location" and assigns a value to the datafield based on that value.

Wednesday, April 16, 2014

Multiple if conditions in a Crystal Reports Record Selection


 When using multiple If statements in a Crystal Reports Record Selection, use parentheses to group your if-then-else statements. These need to be terminated with an Else. If no else exists in your logic, use Else True. Multiple If statements are then separated using an And or Or as seen in the example below:


{TERM} = {?Term} And
{INSTITUTION} = {?Institution} And
(
If ({?Organization} <> "%") Then
    {ACAD_ORG} = {?Organization}
Else True
)
And
(
If ({?Dual Enrollment} = "N") Then
    {HS_DUAL_ENROLL} = "N"
Else If ({?Dual Enrollment} = "Y") Then
    {HS_DUAL_ENROLL} = "Y"
Else True
)

Thursday, February 20, 2014

Updating SharePoint Ribbon Styles and Markup Styles

The SharePoint 2010 Ribbon contains default styles and elements in their Styles and Markup Styles sections. Using CSS, you can add styles or elements as well as hide OOTB styles and elements.

To create new items, use the ms-rteElement or ms-rteStyle prefixes in your CSS file.

H2.ms-rteElement-H2Custom
{
     -ms-name:Title;
     color:#008C99;
     background-color:transparent;
 }

.ms-rteStyle-Normal
{
      -ms-name:"Normal";
      font-size:10pt;
      font-weight:normal;
      background-color:transparent;
}

To remove the Styles button entirely:

#Ribbon\.EditingTools\.CPEditTab\.Styles
{
      display:none;
}

To remove a single element from the Markup Styles list (Change the ElementWithStyle index number to hide the element based on its order in the list.):

li.ms-cui-menusection-items a#ElementWithStyle0-Menu
{
      display:none;
}
li.ms-cui-menusection-items a#ElementWithStyle1-Menu
{
      display:none;
}

Thursday, January 30, 2014

Using rowspan, colspan and nested tables


Below is an example of constructing an HTML table using rowspan, colspan and nesting tables in a cell.


Enrollment Services Finances Take a Placement test
Testing Center
Advising
New Student Orientation
Finances
Become a Student How to Make a Payment Meet with an Advisor
How to Make a Loan Payment


<table  border="1" cellpadding="10">
<tr>
<td>Enrollment Services</td>
<td>Finances</td>
<td>Advising</td>
<td rowspan="4">
<table border="1" cellpadding="5">
<tr>
<td>Testing Center</td>
</tr>
<tr>
<td>New Student Orientation</td>
</tr>
<tr>
<td>New Student Orientation</td>
</tr>
<td>New Student Orientation</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>Become a Student</td>
<td>Enroll in a Class</td>
<td>Meet with an Advisor</td>
</tr>
<tr>
                <td colspan="2">How to Make a Loan Payment</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>