System Utilities ($util)

Document created by DPM Admin on Jul 21, 2017
Version 1Show Document
  • View in full screen mode

Contains general utility methods.

 

System Utilities Methods

 

decodeString

Returns the decoded string. Null if the input string was null or undefined.
The “stringToDecode” specifies the string to be decoded.

The “decodingTypeIndicator” specfies the type of decoding to be done.

string decodeString(stringToDecode, decodingTypeIndicator)

encodeString

Returns the encoded string. Null if the input string was null or undefined.
The “stringToEncode” specifies the string to be decoded.

The “EncodingTypeIndicator” specfies the type of decoding to be done.

string encodeString(stringToEncode, encodingTypeIndicator)

generateRandomString

Returns the generated string. 
The “length” of the string to generate.

The “characterList” is a String containing the pool of characters from which to generate the String. Normally each character would appear exactly once in the list. However, if a character appears multiple times that will give it greater weighting in the random selection and thus that character will tend to appear more often.

string generateRandomString(length, characterList)

generateRandomStringAlpha

Returns the generated string of alphabetic characters of the specified length. The returned string will contain characters in the ranges A-Z and a-z.

The “length” of the string to generate.

string generateRandomStringAlpha(length)

generateRandomStringAlphanumeric

Returns the generated string of alphanumeric characters of the specified length. The returned string will contain characters in the ranges A-Z, a-z, 0-9.

The “length” of the string to generate.

string generateRandomStringAlphanumeric(length)

generateRandomStringDecimalDigits

Returns the generated string of decimal digits of the specified length. The returned string will contain characters in the range 0-9.

The “length” of the string to generate.

string generateRandomStringDecimalDigits(length)

generateRandomStringHexDigits

Returns the generated string of of hexadecimal digits of the specified length. The returned string will contain characters in the ranges A-F and 0-9.

The “length” of the string to generate.

string generateRandomStringHexDigits(length)

readFromURL

 

Reads data from a CSV file (resource) at the specified URL, and returns that data as an array of strings. Each element in the returned array represents a row in the file.  For any row that contains multiple values, the value for that row is a nested array of the values in that row.

Parameters:

  • The url parameter is the URL to read from.
  • The format parameter is optional, but if specified must be the string CSV, which is the only value currently supported.
  • The useCache parameter is optional.  If the value is true, the data that is read is cached in memory, so that subsequent reads from the same URL in the same play of the Composition will retrieve the data from memory rather than re-reading from the URL.  If the value is false, the data will be read from the URL on every call.  If this parameter is omitted or null, true is assumed.

Example 1

If you use the following form:

var dataList = $context.readFromURL("http://www.myhost.com/directory/file.csv", “CSV”, true);

It will be read once on each server.

If you pass in false for the third parameter (or leave off the third parameter), it will be read every time.

Example 2

To read from a file at http://host/files/Locations.csv, the following call would be made:
var userList = $context.readFromURL(http://host/files/Locations.csv);

If the file contained the following lines:

San Francisco,CA,94103
Timbuktu
Caribou,Aroostook County,Maine,USA
Hill Valley,CA,91905

 


The following array of strings would be returned:


userList[0][0]

San Francisco

userList[0][1]

CA

userList[0][2]

94103

userList[1]

Timbuktu

userList[2][0]

Caribou

userList[2][1]

Aroostook County

userList[2][2]

Maine

userList[2][3]

USA

userList[3][0]

Hill Valley

userList[3][1]

CA

userList[3][2]

91905


Array readFromURL(string url, string format,
boolean useCache)

Attachments

    Outcomes