Friday, September 20, 2013
Using the following-sibling to compare node-sets in a SharePoint list
In a table I need to display items from a SharePoint custom list grouped by a column. For styling purposes, I need to identify the last row of each grouping. Using the following-sibling axis, I can look ahead to see if the group value will change. If so, I apply a class to the current table row.
<xsl:template match='Row'>
<tr>
<xsl:if test="@Group != following-sibling::Row[1]/@Group or position() = last()">
<xsl:attribute name="class">lastItem</xsl:attribute>
</xsl:if>
....
</tr>
...
</xsl:template>
In my stylesheet, I can then apply rules to the lastItem class:
table tr { border-bottom: 2px #707070 dotted; }
table tr.lastItem { border-bottom: none; }
Wednesday, July 31, 2013
Displaying multiple parameter values in a Crystal Report
When a Crystal report user chooses multiple values for a parameter, sometime it's nice to display all those parameter values in the report header. The following code can be added to a function for displaying in the header.
Local NumberVar i;
WhilePrintingRecords;
StringVar Array term := {?Term};
StringVar terms := term[1]; StringVar Array term := {?Term};
Local NumberVar i;
For i := 2 To count(term) Do
(
terms := terms + ", " + term[i];
);
(
terms := terms + ", " + term[i];
);
terms
Tuesday, July 2, 2013
Including a link to a javascript file in XSLT
In SharePoint 2010, I was updating a custom version of the ContentQueryMain.xsl file, needing to include javascript for the page. When I added the following code, the layout of the page changed, the ribbon stopped responding and the page would not respond when in edit mode.
Turns out, the XSLT processor didn't care for the empty script tag. Adding the space entity   fixed the problem.
<script type="text/javascript" src="/Script%20Files/myjavascript.js"></script>
Turns out, the XSLT processor didn't care for the empty script tag. Adding the space entity   fixed the problem.
<script type="text/javascript" src="/Script%20Files/myjavascript.js"> </script>
Tuesday, May 7, 2013
Using VLOOKUP in a Google Spreadsheet for adding new rows through form submission
In order to have a VLOOKUP formula apply to new rows added to a Google spreadsheet through form submission, add the following formula to a 2nd row column (below the header).
=arrayformula(vlookup(B2:B,Names!$A$1:$B$360,{2}*sign(row(B2:B)),FALSE))
The first argument of vlookup is the range of cells for your lookup values.
The second argument is your table array. This example uses a 2-column table array.
The third argument is the column index number. The use of the formula 'sign' is key to make an array that is the same length as the first argument.
The fourth argument is a boolean value that specifies whether you want vlookup to find an exact match or an approximate match.
Labels:
Google Doc
Monday, April 22, 2013
Using CSS Direct Descendant Selector with Tables
Recently I was attempting to use a CSS 'direct descendant' selector (>) to set a bottom border on rows in a table. Because there were rows buried deeper in nested tables, I didn't want those to have the border. When I used the following CSS selector, it didn't work.
Turns out, I needed to add a TBODY between the TABLE and TR, even though a TBODY was not showing in the page source because the TBODY is implictly added.
table.employee > tr
Turns out, I needed to add a TBODY between the TABLE and TR, even though a TBODY was not showing in the page source because the TBODY is implictly added.
table.employee > tbody > tr
Thursday, April 4, 2013
Using Request.QueryString in Page_Load in SharePoint page layout
Below is an example of using the Request.QueryString collection in the Page_Load method in a SharePoint page layout. In this case we're looking for the variable named 'tab' and checking for various conditions.
try
{
int index = System.Convert.ToInt32(Request.QueryString["tab"]);
if (index > 1 && index < 5)
{
if (RadTabStrip1.Tabs[index-1].Visible)
{
RadTabStrip1.Tabs[index-1].Selected = true;
RadMultiPage1.PageViews[index-1].Selected = true;
}
}
}
catch (Exception ex)
{
// Response.Write(ex.Message);
}
Thursday, March 28, 2013
Using word-wrap for an AspMenu SharePoint web control with long menu items
I have an AspMenu SharePoint web control with long menu items that do not respect the width of the table cell that I've set even though I have the property 'ItemWrap' set to 'True'. The biggest culprit is users wanting to use a series of underscores to separate one group od links from another. To keep an extra long series of underscores from pushing the table cell wider, I'm using the stylesheet rule 'word-wrap' as shown below.
The ASPMenu control creates this hierarchy of tables.
div#s4-leftpanel table tr td table
{
table-layout:fixed;
}
div#s4-leftpanel table tr td table tr td
{
word-wrap:break-word;
}
The ASPMenu control creates this hierarchy of tables.
div#s4-leftpanel table tr td table
{
table-layout:fixed;
}
div#s4-leftpanel table tr td table tr td
{
word-wrap:break-word;
}
Subscribe to:
Posts (Atom)