Child pages
  • Utils

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.
Enter additional information related to this 'class' inside the {div} macro with 'id=description'
Divcache
styleindexdisplay:none

...

iddescription

...

padding0px
width80px

...

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary

...

Table Cell (td)
String

...

true
refresh100d
showRefreshtrue
iddoc
titleRefresh page
showDatetrue
retryEnable

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClientsWordListMobileClient

servoy sSummary12%30%58%height: 30px;3Methods SummaryReturn the byte array representation of the Base64 valueReturn the String representation of the Base64 valueReturn the Base64 value representation of the byteArrayReturn the string conversion of the byteArrayFormat a date object to a text representation.

...

Table Cell (td)
String

...

Format a date object to a text representation using the format and timezone given.Format a date object to a text representation.Format a date object to a text representation using the format, timezone, language and country given.Returns a string containing the character for the unicode number.

...

Table Cell (td)
Boolean

...

Returns true if the (related)foundset exists and has records.

...

Table Cell (td)
Boolean

...

Table Cell (td)
Boolean

...

Returns true if the (related)foundset exists and has records.

...

Returns true when Monday is the first day of the week for your current locale setting.

...

Table Cell (td)
String

...

Table Cell (td)
String

...

Format a number to have a defined fraction.Format a number to have a defined fraction.

...

Format a number to specification.Format a number to specification.

...

Table Cell (td)
Date

...

Parse a string to a date object.Parse a string to a date object.Parse a string to a date object.Parse a string to a date object.

...

Table Cell (td)
String

...

Returns the escaped markup text (HTML/XML).

...

Table Cell (td)
String

...

Returns the escaped markup text (HTML/XML).

...

Table Cell (td)
String

...

Returns the escaped markup text (HTML/XML).

...

Table Cell (td)
String

...

Formats a string according to format specifiers and arguments

...

Table Cell (td)
String

...

.Format a string using mask.Replaces a portion of a string with replacement text from a specified index.

...

Table Row (tr)
Table Cell (td)
String
Table Cell (td)
stringInitCap(text)
Returns all words starting with capital chars.

...

Table Cell (td)
String

...

Table Cell (td)
String

...

Returns all words starting with capital chars.Returns a string with the requested number of characters, starting from the left.

...

...

Table Cell (td)
String

...

Returns the number of words, starting from the left.

...

...

Table Cell (td)
String

...

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

...

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

...

Table Cell (td)
String

...

Table Cell (td)
String

...

.Returns a substring from the original string.Returns a substring from the original string.

...

Returns

...

the

...

Table Cell (td)
String

...

PBKDF2 hash for specified text.

...

Table Cell (td)
String

...

Returns the PBKDF2 hash for specified text.

...

Table Cell (td)
Number

...

Table Cell (td)
Number

...

Returns the number of times searchString appears in textString.

...

Returns the position of the string to search for, from a certain start position and occurrence.

...

Table Cell (td)
String

...

Replaces a portion of a string with replacement text.

...

Table Cell (td)
String

...

Returns the text with %%tags%% replaced, based on provided record or foundset or form.

...

Table Cell (td)
String

...

Table Row (tr)
Table Cell (td)
String
Table Cell (td)
stringRightWords(text, numberof_words)
Returns the number of words, starting from the right.

...

Table Cell (td)
Number

...

Returns a string with the requested number of characters, starting from the right.

...

Returns the number of words, starting from the right.Return the Base64 representation of the stringReturn the byte array representation of the stringFilters characters out of from a string and leaves digits, returns the number.

...

Table Cell (td)
Number

...

Table Cell (td)
String

...

Filters characters out of from a string and leaves digits, returns the number.

...

Returns the string without leading or trailing spaces.

...

Table Cell (td)
Number

...

Returns the number of words in the text string.

...

Table Cell (td)
Date

...

Table Cell (td)
Boolean

...

Returns a datestamp from the timestamp (sets hours,minutes,seconds and milliseconds to 0).

...

...

Validates the given password against the given hash.

...

function

...

servoy sDetail

...

padding0px
width100%

...

classlastDetailRow

...

idstringInitCap-String
Table Row (tr)
idname
Table Cell (td)
stringInitCap
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringInitCap
Span
(text)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns all words starting with capital chars.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} text - the text to process
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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');

...

classlastDetailRow

...

idstringLeft-String_Number
Table Row (tr)
idname
Table Cell (td)
stringLeft
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringLeft
Span
(text, i_size)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns a string with the requested number of characters, starting from the left.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} text - the text to process
{Number} i_size - the size of the text to return
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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);

...

classlastDetailRow

...

idstringLeftWords-String_Number
Table Row (tr)
idname
Table Cell (td)
stringLeftWords
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringLeftWords
Span
(text, numberof_words)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the number of words, starting from the left.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} text - to process
{Number} numberof_words - to return
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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);

...

classlastDetailRow

...

idstringMD5HashBase16-String
Table Row (tr)
idname
Table Cell (td)
stringMD5HashBase16
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringMD5HashBase16
Span
(textString)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

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
Div
classsIndent
{String} textString - the text to process
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String - the resulting hashString
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var hashed_password = utils.stringMD5HashBase16(user_password)

...

classlastDetailRow

...

idstringMD5HashBase64-String
Table Row (tr)
idname
Table Cell (td)
stringMD5HashBase64
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringMD5HashBase64
Span
(textString)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

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
Div
classsIndent
{String} textString - the text to process
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String - the resulting hashString
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var hashed_password = utils.stringMD5HashBase64(user_password)

...

classlastDetailRow

...

idstringMiddle-String_Number_Number
Table Row (tr)
idname
Table Cell (td)
stringMiddle
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringMiddle
Span
(text, i_start, i_size)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns a substring from the original string.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} text - the text to process
{Number} i_start - the start index to work from
{Number} i_size - the size of the text to return
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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);

...

classlastDetailRow

...

idstringMiddleWords-String_Number_Number
Table Row (tr)
idname
Table Cell (td)
stringMiddleWords
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringMiddleWords
Span
(text, i_start, numberof_words)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns a substring from the original string.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} text - to process
{Number} i_start - start word index
{Number} numberof_words - the word count to return
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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);

...

classlastDetailRow

...

idstringPBKDF2Hash-String
Table Row (tr)
idname
Table Cell (td)
stringPBKDF2Hash
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringPBKDF2Hash
Span
(textString)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

Returns the PBKDF2 hash for specified text. This method is preferred above the old MD5 hash for enhanced security.
It uses a default of 2000 iterations.

NOTE: PBKDF2 is the key hash function for the PKCS (Public-Key Cryptography) standard, for more info see: http://en.wikipedia.org/wiki/PBKDF2

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

...

classlastDetailRow

...

idstringPBKDF2Hash-String_Number
Table Row (tr)
idname
Table Cell (td)
stringPBKDF2Hash
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringPBKDF2Hash
Span
(textString, iterations)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent

Returns the PBKDF2 hash for specified text. This method is preferred above the old MD5 hash for enhanced security.

NOTE: PBKDF2 is the key hash function for the PKCS (Public-Key Cryptography) standard, for more info see: http://en.wikipedia.org/wiki/PBKDF2

Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} textString - the text to process
{Number} iterations - how many hash iterations should be done, minimum should be 1000 or higher.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String - the resulting hashString
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var hashed_password = utils.stringPBKDF2Hash(user_password,5000)

...

classlastDetailRow

...

idstringPatternCount-String_String
Table Row (tr)
idname
Table Cell (td)
stringPatternCount
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
stringPatternCount
Span
(text, toSearchFor)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the number of times searchString appears in textString.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} text - the text to process
{String} toSearchFor - the string to search for
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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');

...

classlastDetailRow

...

idstringPosition-String_String_Number_Number
Table Row (tr)
idname
Table Cell (td)
stringPosition
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
stringPosition
Span
(textString, toSearchFor, i_start, i_occurrence)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the position of the string to search for, from a certain start position and occurrence.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} textString - the text to process
{String} toSearchFor - the string to search
{Number} i_start - the start index to search from
{Number} i_occurrence - the occurrence
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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)

...

classlastDetailRow

...

idstringReplace-String_String_String
Table Row (tr)
idname
Table Cell (td)
stringReplace
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringReplace
Span
(text, search_text, replacement_text)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Replaces a portion of a string with replacement text.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} text - the text to process
{String} search_text - the string to search
{String} replacement_text - the replacement text
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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');

...

classlastDetailRow

...

idstringReplaceTags-String_Object
Table Row (tr)
idname
Table Cell (td)
stringReplaceTags
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringReplaceTags
Span
(text, scriptable)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the text with %%tags%% replaced, based on provided record or foundset or form.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} text - the text tags to work with
{Object} scriptable - the javascript object or foundset,record,form to be used to fill in the tags
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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);
//The next sample shows the use of a javascript object
//var obj = new Object();//create a javascript object
//obj['x'] = 'test';//assign an named value
//var y = utils.stringReplaceTags("The value of object variable is %%x%% ", obj);//use the named value in a tag

...

classlastDetailRow

...

idstringRight-String_Number
Table Row (tr)
idname
Table Cell (td)
stringRight
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringRight
Span
(text, i_size)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns a string with the requested number of characters, starting from the right.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} text - the text to process
{Number} i_size - the size of the text to return
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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);

...

classlastDetailRow

...

idstringRightWords-String_Number
Table Row (tr)
idname
Table Cell (td)
stringRightWords
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringRightWords
Span
(text, numberof_words)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the number of words, starting from the right.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} text - to process
{Number} numberof_words - to return
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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);

...

classlastDetailRow

...

idstringToNumber-String
Table Row (tr)
idname
Table Cell (td)
stringToNumber
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
stringToNumber
Span
(textString)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Filters characters out of from a string and leaves digits, returns the number. Uses locale decimal separator.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} textString - the text to process
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number - the resulting number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//returns 65567
var retval = utils.stringToNumber('fg65gf567');

...

classlastDetailRow

...

idstringToNumber-String_String
Table Row (tr)
idname
Table Cell (td)
stringToNumber
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
stringToNumber
Span
(textString, decimalSeparator)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Filters characters out of from a string and leaves digits, returns the number. Decimal separator is specified as parameter.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} textString - the text to process
{String} decimalSeparator - decimal separator
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number - the resulting number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//returns 65.567
var retval = utils.stringToNumber('fg65gf.567','.');

...

classlastDetailRow

...

idstringTrim-String
Table Row (tr)
idname
Table Cell (td)
stringTrim
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringTrim
Span
(textString)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the string without leading or trailing spaces.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} textString - the text to process
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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   ');

...

classlastDetailRow

...

idstringWordCount-String
Table Row (tr)
idname
Table Cell (td)
stringWordCount
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
stringWordCount
Span
(text)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the number of words in the text string.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} text - the text to process
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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');

...

classlastDetailRow

...

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

...

classlastDetailRow

...

idvalidatePBKDF2Hash-String_String
Table Row (tr)
idname
Table Cell (td)
validatePBKDF2Hash
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
validatePBKDF2Hash
Span
(password, hash)

...

iddes

...

classsIndent

Validates the given password against the given hash. The hash should be generated by one of the stringPBKDF2Hash(password [,iteration]) functions. If hash is null or empty string the method will return false.

...

2100%height:30px

...

Table Head (th)
colspan1
Method Details

...

iddateFormat-Date_String
Table Row (tr)
idname
Table Cell (td)
dateFormat
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
dateFormat
Span
(date, format)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Format a date object to a text representation.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{Date} date - the date
{String} format - the format to output
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String - the date as text
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var formattedDateString = utils.dateFormat(dateobject,'EEE, d MMM yyyy HH:mm:ss');

...

classlastDetailRow

...

idgetUnicodeCharacter-Number
Table Row (tr)
idname
Table Cell (td)
getUnicodeCharacter
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getUnicodeCharacter
Span
(unicodeCharacterNumber)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns a string containing the character for the unicode number.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{Number} unicodeCharacterNumber - the number indicating the unicode character
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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);

...

classlastDetailRow

...

idhasRecords-JSFoundSet
Table Row (tr)
idname
Table Cell (td)
hasRecords
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
hasRecords
Span
(foundset)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
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
Div
classsIndent
{JSFoundSet} foundset - the foundset to be tested
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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
//}

...

classlastDetailRow

...

idhasRecords-JSRecord_String
Table Row (tr)
idname
Table Cell (td)
hasRecords
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
hasRecords
Span
(record, relationString)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
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
Div
classsIndent
{JSRecord} record - A JSRecord to test.
{String} relationString - The relation name.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean - true if the foundset/relation has records.
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
//}

...

classlastDetailRow

...

idisMondayFirstDayOfWeek
Table Row (tr)
idname
Table Cell (td)
isMondayFirstDayOfWeek
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
isMondayFirstDayOfWeek
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true when Monday is the first day of the week for your current locale setting.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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
}

...

classlastDetailRow

...

idnumberFormat-Number_Number
Table Row (tr)
idname
Table Cell (td)
numberFormat
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
numberFormat
Span
(number, digits)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Format a number to have a defined fraction.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{Number} number - the number to format
{Number} digits - nr of digits
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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

...

classlastDetailRow

...

idnumberFormat-Number_String
Table Row (tr)
idname
Table Cell (td)
numberFormat
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
numberFormat
Span
(number, format)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Format a number to specification.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{Number} number - the number to format
{String} format - the format
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String - the resulting number in text
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var textalNumber2 = utils.numberFormat(100006.749, '#,###.00'); //returns 100,006.75

...

classlastDetailRow

...

idparseDate-String_String
Table Row (tr)
idname
Table Cell (td)
parseDate
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Date
Span
stylefont-weight: bold;
parseDate
Span
(date, format)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Parse a string to a date object.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} date - the date as text
{String} format - the format to parse the to date
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Date - the date as date object
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var parsedDate = utils.parseDate(datestring,'EEE, d MMM yyyy HH:mm:ss');

...

classlastDetailRow

...

idstringEscapeMarkup-String
Table Row (tr)
idname
Table Cell (td)
stringEscapeMarkup
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringEscapeMarkup
Span
(textString)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the escaped markup text (HTML/XML).
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} textString - the text to process
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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>')

...

classlastDetailRow

...

idstringEscapeMarkup-String_Boolean
Table Row (tr)
idname
Table Cell (td)
stringEscapeMarkup
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringEscapeMarkup
Span
(textString, escapeSpaces)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the escaped markup text (HTML/XML).
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} textString - the text to process
{Boolean} escapeSpaces - indicating to escape spaces
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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>')

...

classlastDetailRow

...

idstringEscapeMarkup-String_Boolean_Boolean
Table Row (tr)
idname
Table Cell (td)
stringEscapeMarkup
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringEscapeMarkup
Span
(textString, escapeSpaces, convertToHtmlUnicodeEscapes)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the escaped markup text (HTML/XML).
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} 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
Div
classsIndent
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>')

...

classlastDetailRow

...

idstringFormat-String_ObjectArray
Table Row (tr)
idname
Table Cell (td)
stringFormat
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringFormat
Span
(text_to_format, parameters)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Formats a string according to format specifiers and arguments.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} text_to_format - the text to format
{Object[]} parameters - the array with parameters
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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

...

classlastDetailRow

...

idstringIndexReplace-String_Number_Number_String
Table Row (tr)
idname
Table Cell (td)
stringIndexReplace
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
stringIndexReplace
Span
(text, i_start, i_size, replacement_text)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Replaces a portion of a string with replacement text from a specified index.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} text - the text to process
{Number} i_start - the start index to work from
{Number} i_size - the size of the text to replace
{String} replacement_text - the replacement text
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
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');
2Methods Detailsbase64ToBytesname

base64ToBytes(base64String:)

dessIndent
Return the byte array representation of the Base64 value
prs

Parameters

sIndentbase64String:the Base64 encoded string to convert to byte array
ret

Returns

sIndent byteArray representation of the base64 string using UTF-8 charset for conversion
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
base64ToStringname

base64ToString(base64String:)

dessIndent
Return the String representation of the Base64 value
prs

Parameters

sIndentbase64String:the Base64 value to convert to String
ret

Returns

sIndent String decoded representation of the Base64 value using UTF-8 charset for conversion
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
bytesToBase64name

bytesToBase64(byteArray:)

dessIndent
Return the Base64 value representation of the byteArray
prs

Parameters

sIndentbyteArray:the byte array to convert to Base64 value
ret

Returns

sIndent Base64 representation of the byte array using UTF-8 charset for conversion
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
bytesToHexname

bytesToHex(bytearray)

dessIndentprs

Parameters

sIndentbytearraythe byte array to convert to hex encoded string
ret

Returns

sIndent returns hex encoded string from bytearray
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
bytesToStringname

bytesToString(byteArray:)

dessIndent
Return the string conversion of the byteArray
prs

Parameters

sIndentbyteArray:the byte array to convert to
ret

Returns

sIndent string representation of the byte array using UTF-8 charset for conversion
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
dateFormatname

dateFormat(date, format)

dessIndent
Format a date object to a text representation.
This will format with the system timezone for the webclient
For NGClient it will use the timezone of the client, the same goes for the Smartclient (but that is the system timezone)
see #dateFormat(Date,String,String) for using the actual clients timezone.

Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'.
Symbols meaning is:
 G        era designator
 y        year
 Y        week year
 M        month in year
 d        day in month
 h        hour in am/pm (1~12)
 H        hour in day (0~23)
 m        minute in hour
 s        second in minute
 S        millisecond
 E        day in week
 D        day in year
 F        day of week in month
 w        week in year
 W        week in month
 a        am/pm marker
 z        time zone
 k        hour in day (1~24)
 K        hour in am/pm (0~11)
prs

Parameters

sIndentdatethe dateformatthe format to output
ret

Returns

sIndent the date as text
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow
dateFormatname

dateFormat(date, format, timezone)

dessIndent
Format a date object to a text representation using the format and timezone given.
If the timezone is not given the timezone of the client itself will be used.
see i18n.getAvailableTimeZoneIDs() to get a timezone string that can be used.

Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'
Symbols meaning is:
 G        era designator
 y        year
 Y        week year
 M        month in year
 d        day in month
 h        hour in am/pm (1~12)
 H        hour in day (0~23)
 m        minute in hour
 s        second in minute
 S        millisecond
 E        day in week
 D        day in year
 F        day of week in month
 w        week in year
 W        week in month
 a        am/pm marker
 z        time zone
 k        hour in day (1~24)
 K        hour in am/pm (0~11)
prs

Parameters

sIndentdatethe dateformatthe format to outputtimezoneThe timezone string to use to parse the date (like GMT+3), if null then the timezone of the current client is used.
ret

Returns

sIndent the date as text
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
dateFormatname

dateFormat(date, format, language, country)

dessIndent
Format a date object to a text representation.
This will format with the system timezone for the webclient
With language and/or country the locale will be created.
For NGClient it will use the timezone of the client, the same goes for the Smartclient (but that is the system timezone)
see #dateFormat(Date,String,String) for using the actual clients timezone.

Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'.
Symbols meaning is:
 G        era designator
 y        year
 Y        week year
 M        month in year
 d        day in month
 h        hour in am/pm (1~12)
 H        hour in day (0~23)
 m        minute in hour
 s        second in minute
 S        millisecond
 E        day in week
 D        day in year
 F        day of week in month
 w        week in year
 W        week in month
 a        am/pm marker
 z        time zone
 k        hour in day (1~24)
 K        hour in am/pm (0~11)
prs

Parameters

sIndentdatethe dateformatthe format to outputlanguagelanguage used to create localecountrycountry used along side language to create the locale
ret

Returns

sIndent the date as text
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
dateFormatname

dateFormat(date, format, timezone, language, country)

dessIndent
Format a date object to a text representation using the format, timezone, language and country given.
With the language and country given, the locale will be created.
If the timezone is not given the timezone of the client itself will be used.
see i18n.getAvailableTimeZoneIDs() to get a timezone string that can be used.

Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'
Symbols meaning is:
 G        era designator
 y        year
 Y        week year
 M        month in year
 d        day in month
 h        hour in am/pm (1~12)
 H        hour in day (0~23)
 m        minute in hour
 s        second in minute
 S        millisecond
 E        day in week
 D        day in year
 F        day of week in month
 w        week in year
 W        week in month
 a        am/pm marker
 z        time zone
 k        hour in day (1~24)
 K        hour in am/pm (0~11)
prs

Parameters

sIndentdatethe dateformatthe format to outputtimezonethe timezone to use the format, if null then current client timezone is used.languagelanguage used to create localecountrycountry used along side language to create the locale
ret

Returns

sIndent the date as text
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getUnicodeCharactername

getUnicodeCharacter(unicodeCharacterNumber)

dessIndent
Returns a string containing the character for the unicode number.
prs

Parameters

sIndentunicodeCharacterNumberthe number indicating the unicode character
ret

Returns

sIndent a string containing the unicode character
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
hasRecordsname

hasRecords(foundset)

dessIndent
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
prs

Parameters

sIndentfoundsetthe foundset to be tested
ret

Returns

sIndent true if exists
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow
hasRecordsname

hasRecords(record, relationString)

dessIndent
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
prs

Parameters

sIndentrecordA JSRecord to test.relationStringThe relation name.
ret

Returns

sIndent true if the foundset/relation has records.
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow
hexToBytesname

hexToBytes(hex)

dessIndentprs

Parameters

sIndenthexhex encoded string to be decoded into a byte array.
ret

Returns

sIndent a byte array from hex encoded string
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
hexToStringname

hexToString(hex)

dessIndentprs

Parameters

sIndenthex ;
ret

Returns

sIndent returns decoded string from hex
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
isMondayFirstDayOfWeekname

isMondayFirstDayOfWeek()

dessIndent
Returns true when Monday is the first day of the week for your current locale setting.
ret

Returns

sIndent true if Monday is first day of the week in current locale
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
numberFormatname

numberFormat(number, digits)

dessIndent
Format a number to have a defined fraction.
prs

Parameters

sIndentnumberthe number to formatdigitsnr of digits
ret

Returns

sIndent the resulting number in text
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow
numberFormatname

numberFormat(number, digits, language, country)

dessIndent
Format a number to have a defined fraction.
prs

Parameters

sIndentnumberthe number to formatdigitsnr of digitslanguagelanguage used to create localecountrycountry used along side language to create the locale
ret

Returns

sIndent the resulting number in text
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
numberFormatname

numberFormat(number, format)

dessIndent
Format a number to specification.
prs

Parameters

sIndentnumberthe number to formatformatthe format
ret

Returns

sIndent the resulting number in text
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient,MobileClient
sam

Sample

sIdentjavascript
lastDetailRow
numberFormatname

numberFormat(number, format, language, country)

dessIndent
Format a number to specification.
prs

Parameters

sIndentnumberthe number to formatformatthe formatlanguagelanguage used to create localecountrycountry used along side language to create the locale
ret

Returns

sIndent the resulting number in text
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
parseDatename

parseDate(date, format)

dessIndent
Parse a string to a date object. This parses the date using the TimeZone of the server
Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'
prs

Parameters

sIndentdatethe date as textformatthe format to parse the date
ret

Returns

sIndent the date as date object
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
parseDatename

parseDate(date, format, timezone)

dessIndent
Parse a string to a date object. Using the timezone that is given, if null then it formats it with the clients timezone.

see i18n.getAvailableTimeZoneIDs() to get a timezone string that can be used.

Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'
prs

Parameters

sIndentdatethe date as textformatthe format to parse the datetimezoneThe timezone string to use to parse the date (like GMT+3)
ret

Returns

sIndent the date as date object
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
parseDatename

parseDate(date, format, language, country)

dessIndent
Parse a string to a date object. Using language and country that are given,
if null then it formats it with the locale of the client

Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'
prs

Parameters

sIndentdatethe date as textformatthe format to parse the datelanguagelanguage used to create localecountrycountry used along side language to create the locale
ret

Returns

sIndent the date as date object
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
parseDatename

parseDate(date, format, timezone, language, country)

dessIndent
Parse a string to a date object. Using the timezone, language and country that are given,
if null then it formats it with the timezone and locale of the client

see i18n.getAvailableTimeZoneIDs() to get a timezone string that can be used.

Format can be a string like: 'dd-MM-yyyy' , 'dd-MM-yyyy HH:mm' , 'MM/dd/yyyy', 'MM/dd/yyyy hh:mm aa', 'dd.MM.yyyy'
prs

Parameters

sIndentdatethe date as textformatthe format to parse the datetimezoneThe timezone string to use to parse the date (like GMT+3)languagelanguage used to create localecountrycountry used along side language to create the locale
ret

Returns

sIndent the date as date object
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringEscapeMarkupname

stringEscapeMarkup(textString)

dessIndent
Returns the escaped markup text (HTML/XML).
prs

Parameters

sIndenttextStringthe text to process
ret

Returns

sIndent the escaped text
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringEscapeMarkupname

stringEscapeMarkup(textString, escapeSpaces)

dessIndent
Returns the escaped markup text (HTML/XML).
prs

Parameters

sIndenttextStringthe text to processescapeSpacesindicating to escape spaces
ret

Returns

sIndent the escaped text
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringEscapeMarkupname

stringEscapeMarkup(textString, escapeSpaces, convertToHtmlUnicodeEscapes)

dessIndent
Returns the escaped markup text (HTML/XML).
prs

Parameters

sIndenttextStringthe text to processescapeSpacesindicating to escape spacesconvertToHtmlUnicodeEscapesindicating to use unicode escapes
ret

Returns

sIndent the escaped text
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringFormatname

stringFormat(text_to_format, parameters)

dessIndent
Formats a string according to format specifiers and arguments.
prs

Parameters

sIndenttext_to_formatthe text to formatparametersthe array with parameters
ret

Returns

sIndent the formatted text
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringFormatname

stringFormat(text, format)

dessIndent
Format a string using mask.
prs

Parameters

sIndenttextthe string to formatformatthe format
ret

Returns

sIndent the resulting text
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringIndexReplacename

stringIndexReplace(text, i_start, i_size, replacement_text)

dessIndent
Replaces a portion of a string with replacement text from a specified index.
prs

Parameters

sIndenttextthe text to processi_startthe start index to work fromi_sizethe size of the text to replacereplacement_textthe replacement text
ret

Returns

sIndent the changed text string
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringInitCapname

stringInitCap(text)

dessIndent
Returns all words starting with capital chars.
prs

Parameters

sIndenttextthe text to process
ret

Returns

sIndent the changed text
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringLeftname

stringLeft(text, i_size)

dessIndent
Returns a string with the requested number of characters, starting from the left.
prs

Parameters

sIndenttextthe text to processi_sizethe size of the text to return
ret

Returns

sIndent the result text string
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringLeftWordsname

stringLeftWords(text, numberof_words)

dessIndent
Returns the number of words, starting from the left.
prs

Parameters

sIndenttextto processnumberof_wordsto return
ret

Returns

sIndent the string with number of words form the left
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringMD5HashBase16name

stringMD5HashBase16(textString)

dessIndent
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
prs

Parameters

sIndenttextStringthe text to process
ret

Returns

sIndent the resulting hashString
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringMD5HashBase64name

stringMD5HashBase64(textString)

dessIndent
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
prs

Parameters

sIndenttextStringthe text to process
ret

Returns

sIndent the resulting hashString
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringMiddlename

stringMiddle(text, i_start, i_size)

dessIndent
Returns a substring from the original string.
prs

Parameters

sIndenttextthe text to processi_startthe start index to work fromi_sizethe size of the text to return
ret

Returns

sIndent the result text string
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringMiddleWordsname

stringMiddleWords(text, i_start, numberof_words)

dessIndent
Returns a substring from the original string.
prs

Parameters

sIndenttextto processi_startstart word indexnumberof_wordsthe word count to return
ret

Returns

sIndent the string with number of words form the left and
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringPBKDF2Hashname

stringPBKDF2Hash(textString)

dessIndent
Returns the PBKDF2 hash for specified text. This method is preferred above the old MD5 hash for enhanced security.
It uses a default of 9999 iterations. The string that is returned can only be used in the utils.validatePBKDF2Hash(password,thisReturnValue)
to check if this hash is a result of that password.
This will always be false: utils.stringPBKDF2Hash("test") == utils.stringPBKDF2Hash("test"). Because for the same string in multiply calls it will not generate the same hash.
So you can only check it like this: utils.validatePBKDF2Hash("test",utils.stringPBKDF2Hash("test"))

NOTE: PBKDF2 is the key hash function for the PKCS (Public-Key Cryptography) standard, for more info see: http://en.wikipedia.org/wiki/PBKDF2
prs

Parameters

sIndenttextStringthe text to process
ret

Returns

sIndent the resulting hashString
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringPBKDF2Hashname

stringPBKDF2Hash(textString, iterations)

dessIndent
Returns the PBKDF2 hash for specified text. This method is preferred above the old MD5 hash for enhanced security.

NOTE: PBKDF2 is the key hash function for the PKCS (Public-Key Cryptography) standard, for more info see: http://en.wikipedia.org/wiki/PBKDF2
prs

Parameters

sIndenttextStringthe text to processiterationshow many hash iterations should be done, minimum should be 1000 or higher.
ret

Returns

sIndent the resulting hashString
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringPatternCountname

stringPatternCount(text, toSearchFor)

dessIndent
Returns the number of times searchString appears in textString.
prs

Parameters

sIndenttextthe text to processtoSearchForthe string to search for
ret

Returns

sIndent the occurrenceCount that the search string is found in the text
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringPositionname

stringPosition(textString, toSearchFor, i_start, i_occurrence)

dessIndent
Returns the position of the string to search for, from a certain start position and occurrence.
prs

Parameters

sIndenttextStringthe text to processtoSearchForthe string to searchi_startthe start index to search fromi_occurrencethe occurrence
ret

Returns

sIndent the position
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringReplacename

stringReplace(text, search_text, replacement_text)

dessIndent
Replaces a portion of a string with replacement text.
prs

Parameters

sIndenttextthe text to processsearch_textthe string to searchreplacement_textthe replacement text
ret

Returns

sIndent the changed text string
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringReplaceTagsname

stringReplaceTags(text, scriptable)

dessIndent
Returns the text with %%tags%% replaced, based on provided record or foundset or form.
prs

Parameters

sIndenttextthe text tags to work withscriptablethe javascript object or foundset,record,form to be used to fill in the tags
ret

Returns

sIndent the text with replaced tags
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringRightname

stringRight(text, i_size)

dessIndent
Returns a string with the requested number of characters, starting from the right.
prs

Parameters

sIndenttextthe text to processi_sizethe size of the text to return
ret

Returns

sIndent the result text string
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringRightWordsname

stringRightWords(text, numberof_words)

dessIndent
Returns the number of words, starting from the right.
prs

Parameters

sIndenttextto processnumberof_wordsto return
ret

Returns

sIndent the string with number of words form the right
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringToBase64name

stringToBase64(string:)

dessIndent
Return the Base64 representation of the string
prs

Parameters

sIndentstring:the string to convert to Base64
ret

Returns

sIndent Base64 encoded representation of the string using UTF-8 charset for conversion
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringToBytesname

stringToBytes(string:)

dessIndent
Return the byte array representation of the string
prs

Parameters

sIndentstring:the string to convert to bytes
ret

Returns

sIndent byte array representation of the string using UTF-8 charset for conversion
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringToHexname

stringToHex(string)

dessIndentprs

Parameters

sIndentstringString to be encoded into hex
ret

Returns

sIndent returns hex encoded string
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringToNumbername

stringToNumber(textString)

dessIndent
Filters characters out of from a string and leaves digits, returns the number. Uses locale decimal separator.
prs

Parameters

sIndenttextStringthe text to process
ret

Returns

sIndent the resulting number
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringToNumbername

stringToNumber(textString, decimalSeparator)

dessIndent
Filters characters out of from a string and leaves digits, returns the number. Decimal separator is specified as parameter.
prs

Parameters

sIndenttextStringthe text to processdecimalSeparatordecimal separator
ret

Returns

sIndent the resulting number
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringTrimname

stringTrim(textString)

dessIndent
Returns the string without leading or trailing spaces.
prs

Parameters

sIndenttextStringthe text to process
ret

Returns

sIndent the resulting trimmed string
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
stringWordCountname

stringWordCount(text)

dessIndent
Returns the number of words in the text string.
prs

Parameters

sIndenttextthe text to process
ret

Returns

sIndent the word count
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
timestampToDatename

timestampToDate(date)

dessIndent
Returns a datestamp from the timestamp (sets hours,minutes,seconds and milliseconds to 0).
prs

Parameters

sIndentdateobject to be stripped from its time elements
ret

Returns

sIndent the stripped date object
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
validatePBKDF2Hashname

validatePBKDF2Hash(password, hash)

dessIndent
Validates the given password against the given hash. The hash should be generated by one of the stringPBKDF2Hash(password [,iteration]) functions. If hash is null or empty string the method will return false.

NOTE: PBKDF2 is the key hash function for the PKCS (Public-Key Cryptography) standard, for more info see: http://en.wikipedia.org/wiki/PBKDF2

...

...

prs

...

Parameters

...

sIndent

...

password

...

the password to test against

...

hash

...

the hash the password needs to validate to.

...

ret

...

Returns

...

sIndent

...

true if his hash is valid for that passwordclients

...

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

...

classlastDetailRow

...

Sample

...

classsIndent

...

Code Block
languagejavascript
if (utils.validatePBKDF2Hash(user_password, hashFromDb)) {
   // logged in
}
sIdentjavascriptlastDetailRow