Global Functions and Properties
In this article
decodeURIComponent
Description | Decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent. This is similar to the JavaScript decodeURIComponent. |
---|---|
Syntax | decodeURIComponent(encodedURI) |
Examples | Expression: where $Encoded contains "Hello%2C+World%21" Result: "Hello, World!" |
encodeURIComponent
Description | Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by the UTF-8 encoding of the character. This is similar to the JavaScript encodeURIComponent. |
---|---|
Syntax | encodeURIComponent(string) |
Examples | Expression: Result: "Hello%2C+World%21" |
eval
Description | Evaluates the expression represented by the given string. The expression can reference document values and Pipeline parameters. This is similar to the JavaScript eval(). Using eval() has a significant performance penalty and will slow down a pipeline when the document count increases. Most eval() use cases can be replaced with statically defined expressions, or with a dynamically generated expression library file. |
---|---|
Syntax | eval(string) |
Examples | Expression: Result: 7 Expression: Result: false (if the value of the pipeline parameter id is greater than 100) |
false
Description | A Boolean literal This is similar to the JavaScript Boolean literals. |
---|
instanceof
Description | Returns true if the given object is an instance of the given type. This is similar to the JavaScript instanceof. |
---|---|
Syntax | object instanceof type The possible values for the type are: Null, Boolean, String, Number, Object, Array, Date, LocalDate, DateTime, and LocalDateTime. |
Examples | Expression: Result: true Expression: Result: false Expression: Result: true |
isNaN
Description | Determines whether a value is Not-a-Number (NaN) or not. This is similar to the JavaScript isNaN. |
---|---|
Syntax | isNaN(value) |
Examples | Expression: Result: false Expression: Result: true Expression: Result: false |
jsonPath
Description | Reads the values from the given object that match the given JSONPath. If the path is simple and does not traverse multiple paths through the object hierarchy (such as This return value of this function is slightly different from the one described here. Instead of returning false if a path is not found, an error will be raised. |
---|---|
Syntax | jsonPath(obj, path) |
Examples | Expression: This expression will return the "email_address" field in the array of objects at "$SupportTicketDefinition.partners" where the objects have a "type" property with a value of "contact". jsonPath($, "$SupportTicketDefinition.partners[?(value.type=='contact')].email_address")[0] Where "$" contains: { "SupportTicketDefinition": { "partners": [ { "type": "contact", "email_address": "bob@example.com" }, { "type": "emergency", "email_address": "alice@example.com" } ] } } Result: "bob@example.com" |
lib
Description | The global variable that contains the imported expression libraries. |
---|---|
Syntax | lib.library.property(field) |
Examples | lib.library.convertStatus($status) where:
|
null
Description | A literal representing an empty value. This is similar to the JavaScript null. |
---|
parseFloat
Description | Parses a string argument and returns a floating point number. Specifically, this function parses characters into a valid floating-point number left to right. Once a character breaks this condition (like a comma), then the parseFloat function considers the break as the end of the number, and the rest of the string is ignored (see last example). This is similar to the JavaScript parseFloat. |
---|---|
Syntax | parseFloat(string) |
Examples | Expression: Result: 0.0314 Expression: Result: NaN Expression: where $field021 contains "23.536269999999998" toFixed() will format this as a string, not a number. Result: 23.5363 Expression: Result: 3 |
parseInt
Description | Parses a string argument and returns an integer. This is similar to the JavaScript parseInt. Pixels are not currently supported. |
---|---|
Syntax | parseInt(string,radix) |
Examples | Expression: where _id has a value of "101" Result: 101 |
true
Description | A Boolean literal This is similar to the JavaScript Boolean literals. |
---|
typeof
Description | Returns a string indicating the object type. This is similar to the JavaScript typeof. |
---|---|
Syntax | typeof item The possible return values are: "boolean", "number", "string", "object", and "array". |
Examples | Expression: Result: string Expression: Result: number Expression: Result: boolean Expression: where $Array contains an array Result: array Expression: Result: object |
Have feedback? Email documentation@snaplogic.com | Ask a question in the SnapLogic Community
© 2017-2024 SnapLogic, Inc.