Child pages
  • Utils

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Hidden
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING.
		THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE


HTML Table
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Object
Table Cell (td)
#dateFormat(date, format)
Format a date object to a text representation or a parses a datestring to a date object.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getUnicodeCharacter(unicodeCharacterNumber)
Returns a string containing the character for the unicode number.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#hasRecords(foundset_or_record, [qualifiedRelationString])
Returns true if the (related)foundset exists and has records.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#isMondayFirstDayOfWeek()
Returns true when Monday is the first day of the week for your current locale setting.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#numberFormat(number, digitsOrFormat)
Format a number to specification (or to have a defined fraction).
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#stringEscapeMarkup(textString, [escapeSpaces], [convertToHtmlUnicodeEscapes])
Returns the escaped markup text (HTML/XML).
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#stringFormat(text_to_format, parameters_array)
Formats a string according to format specifiers and arguments.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#stringIndexReplace(textString, i_start, i_size, replacement_text)
Replaces a portion of a string with replacement text from a specfied index.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#stringInitCap(text)
Returns all words starting with capital chars.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#stringLeft(textString, i_size)
Returns a string with the requested number of characters, starting from the left.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#stringLeftWords(text, numberof_words)
Returns the number of words, starting from the left.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#stringMD5HashBase16(textString)
Returns the md5 hash (encoded as base16) for specified text.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#stringMD5HashBase64(textString)
Returns the md5 hash (encoded as base64) for specified text.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#stringMiddle(textString, i_start, i_size)
Returns a substring from the original string.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#stringMiddleWords(text, i_start, numberof_words)
Returns a substring from the original string.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#stringPatternCount(textString, searchString)
Returns the number of times searchString appears in textString.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#stringPosition(textString, searchString, i_start, i_occurrence)
Returns the position of the string to seach for, from a certain start position and occurrence.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#stringReplace(text, search_text, replacement_text)
Replaces a portion of a string with replacement text.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#stringReplaceTags(text, foundset_or_record_or_form)
Returns the text with %%tags%% replaced, based on provided record or foundset or form.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#stringRight(textString, i_size)
Returns a string with the requested number of characters, starting from the right.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#stringRightWords(text, numberof_words)
Returns the number of words, starting from the right.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#stringToNumber(textString)
Filters characters out of from a string and leaves digits, returns the number.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#stringTrim(textString)
Returns the string without leading or trailing spaces.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#stringWordCount(textString)
Returns the number of words in the text string.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Date
Table Cell (td)
#timestampToDate(date)
Returns a datestamp from the timestamp (sets hours,minutes,seconds and milliseconds to 0).

HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Method Details
Table Body (tbody)
iddateFormat
classnode
Table Row (tr)
idname
Table Cell (td)
dateFormat
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Object
Span
stylefloat: left; font-weight: bold;
idiets
dateFormat
Span
stylefloat: left;
idiets
(date, format)
Table Row (tr)
iddes
Table Cell (td)
Format a date object to a text representation or a parses a datestring to a date object.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} date – the date as text or date object
{Object} format – the format to output or parse the to date
Table Row (tr)
idret
Table Cell (td)
Returns
Object – the date as text or date object
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var parsedDate = utils.dateFormat(datestring,'EEE, d MMM yyyy HH:mm:ss'); 

var formattedDateString = utils.dateFormat(dateobject,'EEE, d MMM yyyy HH:mm:ss');
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetUnicodeCharacter
classnode
Table Row (tr)
idname
Table Cell (td)
getUnicodeCharacter
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getUnicodeCharacter
Span
stylefloat: left;
idiets
(unicodeCharacterNumber)
Table Row (tr)
iddes
Table Cell (td)
Returns a string containing the character for the unicode number.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Number} unicodeCharacterNumber – the number indicating the unicode character
Table Row (tr)
idret
Table Cell (td)
Returns
String – a string containing the unicode character
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//returns a big dot
var dot = utils.getUnicodeCharacter(9679);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idhasRecords
classnode
Table Row (tr)
idname
Table Cell (td)
hasRecords
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
hasRecords
Span
stylefloat: left;
idiets
(foundset_or_record, [qualifiedRelationString])
Table Row (tr)
iddes
Table Cell (td)
Returns true if the (related)foundset exists and has records.
Another use is, to pass a record and qualified relations string to test multiple relations/foundset at once
Table Row (tr)
idprs
Table Cell (td)
Parameters
foundset_or_record – the foundset or record to be tested
[qualifiedRelationString] – the qualified relation string to reach a related foundset if a record is passes as first paramter
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – true if exists
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//test the orders_to_orderitems foundset 
if (elements.customer_id.hasRecords(orders_to_orderitems))
{
	//do work on relatedFoundSet
}
//test the orders_to_orderitems.orderitems_to_products foundset to be reached from the current record 
//if (elements.customer_id.hasRecords(foundset.getSelectedRecord(),'orders_to_orderitems.orderitems_to_products'))
//{
//	//do work on deeper relatedFoundSet
//}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idisMondayFirstDayOfWeek
classnode
Table Row (tr)
idname
Table Cell (td)
isMondayFirstDayOfWeek
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
isMondayFirstDayOfWeek
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns true when Monday is the first day of the week for your current locale setting.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – true if Monday is first day of the week in current locale
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
if(utils.isMondayFirstDayOfWeek())
{
//a date calculation
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idnumberFormat
classnode
Table Row (tr)
idname
Table Cell (td)
numberFormat
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
numberFormat
Span
stylefloat: left;
idiets
(number, digitsOrFormat)
Table Row (tr)
iddes
Table Cell (td)
Format a number to specification (or to have a defined fraction).
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} number – the number to format
{Object} digitsOrFormat – the format or digits
Table Row (tr)
idret
Table Cell (td)
Returns
String – the resulting number in text
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var textalNumber = utils.numberFormat(16.749, 2); //returns 16.75
var textalNumber2 = utils.numberFormat(100006.749, '#,###.00'); //returns 100,006.75
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringEscapeMarkup
classnode
Table Row (tr)
idname
Table Cell (td)
stringEscapeMarkup
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
stringEscapeMarkup
Span
stylefloat: left;
idiets
(textString, [escapeSpaces], [convertToHtmlUnicodeEscapes])
Table Row (tr)
iddes
Table Cell (td)
Returns the escaped markup text (HTML/XML).
Table Row (tr)
idprs
Table Cell (td)
Parameters
textString – the text to process
{Boolean} [escapeSpaces] – indicating to escape spaces
{Boolean} [convertToHtmlUnicodeEscapes] – indicating to use unicode escapes
Table Row (tr)
idret
Table Cell (td)
Returns
String – the escaped text
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var escapedText = utils.stringEscapeMarkup('<html><body>escape me</body></html>')
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringFormat
classnode
Table Row (tr)
idname
Table Cell (td)
stringFormat
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
stringFormat
Span
stylefloat: left;
idiets
(text_to_format, parameters_array)
Table Row (tr)
iddes
Table Cell (td)
Formats a string according to format specifiers and arguments.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} text_to_format – the text to format
{Object} parameters_array – the array with parameters
Table Row (tr)
idret
Table Cell (td)
Returns
String – the formatted text
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// the  format specifier has the syntax: %[argument_index$][flags][width][.precision]conversion
// argument index is 1$, 2$ ...
// flags is a set of characters that modify the output format
// typical values: '+'(The result will always include a sign), ','(The result will include locale-specific grouping separators)
// width is a non-negative decimal integer indicating the minimum number of characters to be written to the output
// precision is a non-negative decimal integer usually used to restrict the number of characters
// conversion is a character indicating how the argument should be formatted
// typical conversion values: b(boolean), s(string), c(character), d(decimal integer), f(floating number), t(prefix for date and time)
// Date/Time Conversions (used after 't' prefix): 
		// 'H' 	Hour of the day for the 24-hour clock, formatted as two digits with a leading zero as necessary i.e. 00 - 23. 
		// 'I' 	Hour for the 12-hour clock, formatted as two digits with a leading zero as necessary, i.e. 01 - 12. 
		// 'k' 	Hour of the day for the 24-hour clock, i.e. 0 - 23. 
		// 'l' 	Hour for the 12-hour clock, i.e. 1 - 12. 
		// 'M' 	Minute within the hour formatted as two digits with a leading zero as necessary, i.e. 00 - 59. 
		// 'S' 	Seconds within the minute, formatted as two digits with a leading zero as necessary, i.e. 00 - 60 ("60" is a special value required to support leap seconds).
		// 'L' 	Millisecond within the second formatted as three digits with leading zeros as necessary, i.e. 000 - 999.
		// 'p' 	Locale-specific morning or afternoon marker in lower case, e.g."am" or "pm". Use of the conversion prefix 'T' forces this output to upper case. 
		// 'z' 	RFC 822 style numeric time zone offset from GMT, e.g. -0800.
		// 'Z' 	A string representing the abbreviation for the time zone.
		// 'B' 	Locale-specific full month name, e.g. "January", "February".
		// 'b' 	Locale-specific abbreviated month name, e.g. "Jan", "Feb". 
		// 'h' 	Same as 'b'. 
		// 'A' 	Locale-specific full name of the day of the week, e.g. "Sunday", "Monday" 
		// 'a' 	Locale-specific short name of the day of the week, e.g. "Sun", "Mon" 
		// 'C' 	Four-digit year divided by 100, formatted as two digits with leading zero as necessary, i.e. 00 - 99 
		// 'Y' 	Year, formatted as at least four digits with leading zeros as necessary, e.g. 0092 equals 92 CE for the Gregorian calendar. 
		// 'y' 	Last two digits of the year, formatted with leading zeros as necessary, i.e. 00 - 99.
		// 'j' 	Day of year, formatted as three digits with leading zeros as necessary, e.g. 001 - 366 for the Gregorian calendar. 
		// 'm' 	Month, formatted as two digits with leading zeros as necessary, i.e. 01 - 13. 
		// 'd' 	Day of month, formatted as two digits with leading zeros as necessary, i.e. 01 - 31 
		// 'e' 	Day of month, formatted as two digits, i.e. 1 - 31.

		// common compositions for date/time conversion
		// 'R' 	Time formatted for the 24-hour clock as "%tH:%tM" 
		// 'T' 	Time formatted for the 24-hour clock as "%tH:%tM:%tS". 
		// 'r' 	Time formatted for the 12-hour clock as "%tI:%tM:%tS %Tp". The location of the morning or afternoon marker ('%Tp') may be locale-dependent. 
		// 'D' 	Date formatted as "%tm/%td/%ty". 
		// 'F' 	ISO 8601 complete date formatted as "%tY-%tm-%td". 
		// 'c' 	Date and time formatted as "%ta %tb %td %tT %tZ %tY", e.g. "Sun Jul 20 16:17:00 EDT 1969".

utils.stringFormat('%s Birthday: %2$tm %2$te,%2$tY',new Array('My',new Date(2009,0,1))) // returns My Birthday: 01 1,2009
utils.stringFormat('The time is: %1$tH:%1$tM:%1$tS',new Array(new Date(2009,0,1,12,0,0))) // returns The time is: 12:00:00
utils.stringFormat('My %s: %2$.0f, my float: %2$.2f',new Array('integer',10)) // returns My integer: 10, my float: 10.00
utils.stringFormat('Today is: %1$tc',new Array(new Date())) // returns current date/time as:  Today is: Fri Feb 20 14:15:54 EET 2009
utils.stringFormat('Today is: %tF',new Array(new Date())) // returns current date as: Today is: 2009-02-20
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringIndexReplace
classnode
Table Row (tr)
idname
Table Cell (td)
stringIndexReplace
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
stringIndexReplace
Span
stylefloat: left;
idiets
(textString, i_start, i_size, replacement_text)
Table Row (tr)
iddes
Table Cell (td)
Replaces a portion of a string with replacement text from a specfied index.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} textString – the text to process
{Object} i_start – the start index to work from
{Object} i_size – the size of the text to replace
{Object} replacement_text – the replacement text
Table Row (tr)
idret
Table Cell (td)
Returns
String – the changed text string
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//returns 'this was a test'
var retval = utils.stringIndexReplace('this is a test',6,2,'was');
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringInitCap
classnode
Table Row (tr)
idname
Table Cell (td)
stringInitCap
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
stringInitCap
Span
stylefloat: left;
idiets
(text)
Table Row (tr)
iddes
Table Cell (td)
Returns all words starting with capital chars.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} text – the text to process
Table Row (tr)
idret
Table Cell (td)
Returns
String – the changed text
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//returns 'This Is A Test'
var retval = utils.stringInitCap('This is A test');
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringLeft
classnode
Table Row (tr)
idname
Table Cell (td)
stringLeft
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
stringLeft
Span
stylefloat: left;
idiets
(textString, i_size)
Table Row (tr)
iddes
Table Cell (td)
Returns a string with the requested number of characters, starting from the left.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} textString – the text to process
{Object} i_size – the size of the text to return
Table Row (tr)
idret
Table Cell (td)
Returns
String – the result text string
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//returns 'this i'
var retval = utils.stringLeft('this is a test',6);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringLeftWords
classnode
Table Row (tr)
idname
Table Cell (td)
stringLeftWords
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
stringLeftWords
Span
stylefloat: left;
idiets
(text, numberof_words)
Table Row (tr)
iddes
Table Cell (td)
Returns the number of words, starting from the left.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} text – to process
{Object} numberof_words – to return
Table Row (tr)
idret
Table Cell (td)
Returns
String – the string with number of words form the left
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//returns 'this is a'
var retval = utils.stringLeftWords('this is a test',3);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringMD5HashBase16
classnode
Table Row (tr)
idname
Table Cell (td)
stringMD5HashBase16
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
stringMD5HashBase16
Span
stylefloat: left;
idiets
(textString)
Table Row (tr)
iddes
Table Cell (td)

Returns the md5 hash (encoded as base16) for specified text.

NOTE: MD5 (Message-Digest Algorythm 5) is a hash function with a 128-bit hash value, for more info see: http://en.wikipedia.org/wiki/MD5

Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} textString – the text to process
Table Row (tr)
idret
Table Cell (td)
Returns
String – the resulting hashString
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var hashed_password = utils.stringMD5HashBase16(user_password)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringMD5HashBase64
classnode
Table Row (tr)
idname
Table Cell (td)
stringMD5HashBase64
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
stringMD5HashBase64
Span
stylefloat: left;
idiets
(textString)
Table Row (tr)
iddes
Table Cell (td)

Returns the md5 hash (encoded as base64) for specified text.

NOTE: MD5 (Message-Digest Algorythm 5) is a hash function with a 128-bit hash value, for more info see: http://en.wikipedia.org/wiki/MD5

Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} textString – the text to process
Table Row (tr)
idret
Table Cell (td)
Returns
String – the resulting hashString
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var hashed_password = utils.stringMD5HashBase64(user_password)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringMiddle
classnode
Table Row (tr)
idname
Table Cell (td)
stringMiddle
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
stringMiddle
Span
stylefloat: left;
idiets
(textString, i_start, i_size)
Table Row (tr)
iddes
Table Cell (td)
Returns a substring from the original string.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} textString – the text to process
{Object} i_start – the start index to work from
{Object} i_size – the size of the text to return
Table Row (tr)
idret
Table Cell (td)
Returns
String – the result text string
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//returns 'his'
var retval = utils.stringMiddle('this is a test',2,3);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringMiddleWords
classnode
Table Row (tr)
idname
Table Cell (td)
stringMiddleWords
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
stringMiddleWords
Span
stylefloat: left;
idiets
(text, i_start, numberof_words)
Table Row (tr)
iddes
Table Cell (td)
Returns a substring from the original string.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} text – to process
{Object} i_start – start word index
{Object} numberof_words – the word count to return
Table Row (tr)
idret
Table Cell (td)
Returns
String – the string with number of words form the left and
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//returns 'is a'
var retval = utils.stringMiddleWords('this is a test',2,2);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringPatternCount
classnode
Table Row (tr)
idname
Table Cell (td)
stringPatternCount
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
stringPatternCount
Span
stylefloat: left;
idiets
(textString, searchString)
Table Row (tr)
iddes
Table Cell (td)
Returns the number of times searchString appears in textString.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} textString – the text to process
{Object} searchString – the string to search
Table Row (tr)
idret
Table Cell (td)
Returns
Number – the occurrenceCount that the search string is found in the text
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//returns 2 as count
var count = utils.stringPatternCount('this is a test','is');
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringPosition
classnode
Table Row (tr)
idname
Table Cell (td)
stringPosition
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
stringPosition
Span
stylefloat: left;
idiets
(textString, searchString, i_start, i_occurrence)
Table Row (tr)
iddes
Table Cell (td)
Returns the position of the string to seach for, from a certain start position and occurrence.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} textString – the text to process
{Object} searchString – the string to search
{Object} i_start – the start index to search from
{Object} i_occurrence – the occurrence
Table Row (tr)
idret
Table Cell (td)
Returns
Number – the position
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//returns 4 as position
var pos = utils.stringPosition('This is a test','s',1,1)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringReplace
classnode
Table Row (tr)
idname
Table Cell (td)
stringReplace
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
stringReplace
Span
stylefloat: left;
idiets
(text, search_text, replacement_text)
Table Row (tr)
iddes
Table Cell (td)
Replaces a portion of a string with replacement text.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} text – the text to process
{Object} search_text – the string to search
{Object} replacement_text – the replacement text
Table Row (tr)
idret
Table Cell (td)
Returns
String – the changed text string
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//returns 'these are cow 1 and cow 2.'
var retval = utils.stringReplace('these are test 1 and test 2.','test','cow');
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringReplaceTags
classnode
Table Row (tr)
idname
Table Cell (td)
stringReplaceTags
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
stringReplaceTags
Span
stylefloat: left;
idiets
(text, foundset_or_record_or_form)
Table Row (tr)
iddes
Table Cell (td)
Returns the text with %%tags%% replaced, based on provided record or foundset or form.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} text – the text tags to work with
{Object} foundset_or_record_or_form – the foundset or record or form to be used to fill in the tags
Table Row (tr)
idret
Table Cell (td)
Returns
String – the text with replaced tags
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//Next line places a string in variable x, whereby the tag(%%TAG%%) is filled with the value of the database column 'company_name' of the selected record.
var x = utils.stringReplaceTags("The companyName of the selected record is %%company_name%% ", foundset)
//var otherExample = utils.stringReplaceTags("The amount of the related order line %%amount%% ", order_to_orderdetails);
//var recordExample = utils.stringReplaceTags("The amount of the related order line %%amount%% ", order_to_orderdetails.getRecord(i);
//Next line places a string in variable y, whereby the tag(%%TAG%%) is filled with the value of the form variable 'x' of the form named 'main'.
var y = utils.stringReplaceTags("The value of form variable is %%x%% ", forms.main);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringRight
classnode
Table Row (tr)
idname
Table Cell (td)
stringRight
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
stringRight
Span
stylefloat: left;
idiets
(textString, i_size)
Table Row (tr)
iddes
Table Cell (td)
Returns a string with the requested number of characters, starting from the right.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} textString – the text to process
{Object} i_size – the size of the text to return
Table Row (tr)
idret
Table Cell (td)
Returns
String – the result text string
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//returns 'a test'
var retval = utils.stringLeft('this is a test',6);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringRightWords
classnode
Table Row (tr)
idname
Table Cell (td)
stringRightWords
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
stringRightWords
Span
stylefloat: left;
idiets
(text, numberof_words)
Table Row (tr)
iddes
Table Cell (td)
Returns the number of words, starting from the right.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} text – to process
{Object} numberof_words – to return
Table Row (tr)
idret
Table Cell (td)
Returns
String – the string with number of words form the right
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//returns 'is a test'
var retval = utils.stringRightWords('this is a test',3);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringToNumber
classnode
Table Row (tr)
idname
Table Cell (td)
stringToNumber
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
stringToNumber
Span
stylefloat: left;
idiets
(textString)
Table Row (tr)
iddes
Table Cell (td)
Filters characters out of from a string and leaves digits, returns the number.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} textString – the text to process
Table Row (tr)
idret
Table Cell (td)
Returns
Number – the resulting number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//returns '65567'
var retval = utils.stringToNumber('fg65gf567');
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringTrim
classnode
Table Row (tr)
idname
Table Cell (td)
stringTrim
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
stringTrim
Span
stylefloat: left;
idiets
(textString)
Table Row (tr)
iddes
Table Cell (td)
Returns the string without leading or trailing spaces.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} textString – the text to process
Table Row (tr)
idret
Table Cell (td)
Returns
String – the resulting trimmed string
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//returns 'text'
var retval = utils.stringTrim('   text   ');
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstringWordCount
classnode
Table Row (tr)
idname
Table Cell (td)
stringWordCount
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
stringWordCount
Span
stylefloat: left;
idiets
(textString)
Table Row (tr)
iddes
Table Cell (td)
Returns the number of words in the text string.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} textString – the text to process
Table Row (tr)
idret
Table Cell (td)
Returns
Number – the word count
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//returns '4' as result
var retval = utils.stringWordCount('this is a test');
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idtimestampToDate
classnode
Table Row (tr)
idname
Table Cell (td)
timestampToDate
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Date
Span
stylefloat: left; font-weight: bold;
idiets
timestampToDate
Span
stylefloat: left;
idiets
(date)
Table Row (tr)
iddes
Table Cell (td)
Returns a datestamp from the timestamp (sets hours,minutes,seconds and milliseconds to 0).
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} date – object to be stripped from its time elements
Table Row (tr)
idret
Table Cell (td)
Returns
Date – the stripped date object
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var date = utils.timestampToDate(application.getTimeStamp());
Table Row (tr)
classlastDetailRow
Table Cell (td)