Expression Language Examples
In this Page
Object Examples
Conditional Expression
Expression |
|
|---|---|
Description | This example is one way of doing an if-then-else expression. |
Example | For example, to set a default pipeline variable in a document object, if you use the following expression for a mapper variable
|
String Examples
Checking for a Non-empty String
Expression |
|
|---|---|
Description | The expression verifies if |
Checking for an Existing Value
Expression |
|
|---|---|
Description | The expression verifies if |
Checking for a Non-empty String and an Existing Value
Expression |
|
|---|---|
Description | The expression verifies if a property exists in the input document and if |
Creating an Email Address from First Initial, Last Name
Expression |
|
|---|---|
Description | Either expression grabs the first letter of the $first_name field, converts it to lowercase, then adds it to the $last_name value and appends "@example.com" before writing it to $Email. |
Date Examples
Creating and Formatting a Date in a Specific Timezone
Expression |
|
|---|---|
Description | The expression creates the current date time in the PST timezone and formats its output into a string in the form of yyyy-MM-dd. |
Formatting a Date to Include Letters
Expression |
|
|---|---|
Description | The expression creates the current date time and format its output into a string to include the letter "T" and "Z". Characters outside of normal SQLDate specials can be added by escaping them. |
Creating an ISO-formatted Date in the Current Timezone
Expression |
|
|---|---|
Description | The expression creates the current date time in the local time zone and formats its output into a string for the ISO date time format. |
Parsing a Date
Expression |
|
|---|---|
Description | This expression parses a string representation of $StandardDate into a DateTime object. The string representation should have one of the following formats:
|
Parsing a Non-standard Date
Expression |
|
|---|---|
Description | These examples parse the date into a DateTime object using the provided format. |
Formatting Today's Date to Display as the Current Month
Expression |
|
|---|---|
Description | This expression takes today's date and formats the output in a string indicating the month in text. |
Filtering Examples
Filtering for Two Possible Values
Expression |
|
|---|---|
Description | Used in a Filter Snap, this expression finds only those items that have $Priority set to either Resolve Immediately or High Attention. |
Filtering by Multiple Fields
Expression |
|
|---|---|
Description | Used in a Filter Snap, this expression finds only those items that are in the $Workflow step of Ready for Testing and $Priority is set to either Resolve Immediately or High Attention. |
Filtering by Date within Timeframe
Expression |
|
|---|---|
Description | Used in a Filter Snap, this expression finds only those items that have a $CloseDate within the last 24 hours. |
Other Examples
Making a Field Value a Link
Expression |
|
|---|---|
Description | This expression turns the value of the $ID field into a HTML link pointing to the location found in the $Link field. |
Mapping Values to an Array
This series of expressions maps data from:
[
{
"ORG_ASSIGNMENT": [
{
"ORGTXT": "Network Services",
"JOBTXT": "Service technician",
"POSTXT": "Manager"
}
]to name/value pairs within an array:
[
"Organization": {
"Unit": [
[
"Position",
"Manager"
],
[
"Grade",
"Service technician"
],
[
"Division",
"Network Services"
]
]
}
]
Expression |
|
|---|---|
Target path | $Users.User[*].Organization.Unit[0] |
Expression |
|
|---|---|
Target path | $Users.User[*].Organization.Unit[1] |
Expression |
|
|---|---|
Target path | $Users.User[*].Organization.Unit[3] |
Have feedback? Email documentation@snaplogic.com | Ask a question in the SnapLogic Community
© 2017-2025 SnapLogic, Inc.