Home> Products> SPSRollUp WebPart> SPS Namespace Functions

SPS Namespace Functions



The SPSRollUp Engine has an engine to extend the XSL namespace. To refer to this namespace you need to add in the XSLT header these:

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:sps="http://schemas.spsprofessional.com/WebParts/SPSXSLT"> 

Then you can use the internal SPSRollUp functions; There are two groups, the first one are functions to manage the behavior of the SPSRollUp control, and the second one are functions to improve the work with the XSLT, some of this functions are similar to functions provided with the standard SharePoint Data View WebPart control.

Control Functions

Event

Syntax: Event(command,parameter)

To send an event to the control, the possible commands are; Select, to select a record; Page to send a page’s change; and Sort, to sort the results.

Sample:  

<
a href="{sps:Event('Send',_RowNumber)}">Select</a>

EventJS

Syntax: EventJS(command,parameter)

Similar to Event, for use inside Javascript.

Other Functions

Counter

Syntax: Counter()

Returns an incremental number. The number remains unique over the page requests unless the application module is unloaded.

DateDiff [v2]

Syntax: DateDiff(string interval, DateTime date1, DateTime date2)

Where interval is "Y" for years, "MM" for months, "D" for days, "W" for weeks, "H" for hours, "M" for minutes, "S" for seconds. DateDiff returns in the specified format the difference between date1 and date2.

FormatDateTime / FormatIsoDateTime [v3]

Syntax: FormatDateTime(string sDate, long lcid, string sFormat)
Syntax: FormatDateTime(string sDate, string sFormat)
Syntax: FormatIsoDateTime(string sDate, long lcid, string sFormat)
Syntax: FormatIsoDateTime(string sDate, string sFormat)

The parameter sDate is converted to a DateTime. This is based on the sFormat parameter, which is a standard DateTime formatting flag, a new DateTime string then is constructed in the given locale lcid. (see specifiers in: DateFormats)

GetFileExtension

Syntax: GetFileExtension(string targetUrl)

Returns the targetUrl’ extension file. (The portion after the "." character). If an extension is not present, an empty string will return.

GetStringBeforeSeparator

Syntax: GetStringBeforeSeparator(string inputString)

Given the string’s parameter inputString, this function returns the part before the first ";" or "#" character. For example, if szval is "Aaaaa;Bbbbb", the string "Aaaaa" will be returned.

IfNew

Syntax: GetStringBeforeSeparator(string createdTime)

Returns true if the parameter createdTime is less than two days old; otherwise, it will return false.

MapToIcon

Syntax: MapToIcon(string fileName, string programId)

Returns the Icon for the given file name or program. The Icon is the name for the .gif file, without the complete path to the file.

Sample:  

<img src="_layouts/images/{sps:MapToIcon(FileRef,'')" />

LookupValue [v3]

Syntax: LookupValue(string lookup)

Remove the id from a lookup value for 1;#Value return value.

LookupId [v3]

Syntax: LookupId(string lookup)

Remove the value from a lookup value for 1;#Value return 1.

Limit

Syntax: Limit(string inputText, int maxLength, string additionalText)

If the given string’s parameter inputText is longer than ten characters, this function returns the first ten characters, with the additionalText string appended. Otherwise the input string will be returned unmodified. Note, this function should not be used with HTML strings as the string is truncated without taking into account the HTML markup.

Replace [v3]

Syntax: Replace(string sourceText, string searchText, string replaceText)

Replace text in a string

RootWebUrl [v3]

Syntax: RootWebUrl()

Returns a string that contains the current web url.

SourceParam [v3]

Syntax: SourceParam()

Returns a string that contains "&Source=(current url)" where current url is the url of current page, you can use this function when you links a SharePoint page as an edit page to return to the current page.

Today

Syntax: Today()

Returns the current date and current time, in the format MM/dd/yyyy HH:mm:ss

TodayIso

Syntax: TodayIso()

Return the current day and current time, in the format yyyy-MM-ddTHH:mm:ss

UrlBaseName

Syntax: UrlBaseName(string targetUrl)

Returns the file’s basename into the URL targetUrl . For example, if targetUrl is /path/path/basename.exten the value basename will be returned.

UrlDirName

Syntax: UrlDirName(string targetUrl)

Returns the directory name file into the URL targetUrl. For example, if targetUrl is /path/path/basename.exten the value /path/path will be returned.

UrlEncode

Syntax: UrlEncode(string stringToEncode)

The string parameter szUrl is encoded so it can be safely used as part of a URL.

UrlParam [v3]

Syntax: UrlParameter(string key, string value)

Return a string in the format &key=value

XmlDecode [v3]

Syntax: XmlDecode(string text)

Decode a string that contains Xml codes, Created_x0020_By -> Created By

Color Functions

GetFcColor [v3]

Syntax: GetFcColor()

Returns a different color each time. For use with Fussion Charts.

GetCalColor [v3]

Syntax: GetCalColor()

Returns a different color each time. For use with Calendar. (See also SPSCalendar.css)