LogoLogo
Changelog
17.14
17.14
  • Welcome
    • Quickstart
    • Building Your First App
      • Connecting your Contact Form to Salesforce (Advanced)
      • Building Your First App (Appendix)
    • Terminology
    • Airkit Flight School
  • Concepts
    • Journeys
      • Linking to Journeys
    • Actors
      • Conversations with Actors
    • Variable Scopes
  • Studio
    • Studio
    • Builder Bar
      • Journey Builder
      • Web Builder
      • Chat Bot Builder
      • Voice Bot Builder
      • Connection Builder
      • Media Library
      • Data Builder
      • Theme Builder
      • Calendar Builder
      • Configuration Builder
      • Portal Builder
    • App Preview
    • Action Builder
  • Architecture
    • Console
    • Web Flows
    • Data Flows
    • Events
      • Starting Events
      • Journey Events
      • Control Events
      • Activity Events
      • App API and Subscription Events
    • AirData
    • Standard Journey Data
    • Datastores
  • Building Apps
    • Working with Data
    • Forms
      • Form Basics
      • Hiding and Showing Sections of a Form Dynamically
      • Repeating Elements in Forms
      • Dynamic forms based on user input
      • Form Personalization
      • Validation of Forms and User Data
      • How to Capture Secure User Data
      • Creating a Progress Bar
      • Creating a Radio Button List
      • Creating A Dropdown
      • Complex Objects in a Dropdown
      • Working with Option Lists vs Dynamic Lists
      • Using the signature input for electronic signature
    • Voice and Chat
      • Building a Simple Voice Bot
      • Building a Simple Chat Bot
      • Connecting Your Twilio Numbers To Airkit
      • Sending Journey Links via Chat Bot
      • Information Captured from Incoming Calls and SMS
    • KitCloud
      • Using Web Flow Templates
      • Using Data Flow Templates
    • Integrations and APIs
      • Setting up Integrations
      • Creating an API for your Airkit App
      • Passing Data from External Systems
      • Receiving Inbound HTTP API Requests with your App
      • Securing API Endpoints with Airkit API Tokens and Permissions
      • Querying and Manipulating Data From External Systems
      • Adding and Modifying Resources
      • Creating SFTP Credentials
      • Swagger Schema Validation
      • Create A Salesforce Lead
      • Create a Zendesk Ticket
      • Integration Examples
      • Your APIs and Systems Connect to Airkit
    • AirData
      • AirData App Objects
      • AirData Querying Capabilities
      • Schedule Objects
    • Calendars
      • Creating an Availability Schedule and tying it to a Scheduler Control
      • Best Practices for calendar and calendarRestriction
      • Using the Scheduler Web Control to Reschedule Deflected Calls
      • Integrating to External Calendar Systems
    • Maps and Addresses
      • Working With Maps
      • Working With Addresses
      • Working With Different Address Formats
      • Working with the Users Current Location
    • Payments
      • Creating a Stripe Integration
    • Email
      • Sending Emails
      • Configuring a Domain For Sending Email
    • Timers and Reminders
      • Scheduling and Reminders
      • Journey Specific Timers and Reminders
      • Setting up Periodic Tasks
    • PDFs
      • Creating a PDF
      • Working with Existing PDFs
      • Example HTML Code to Create a PDF
    • Assets and Media
      • Designing the UI for the File Upload Web Control
      • Working with Files and Media
      • Working with Assets in Data Operations
      • Uploading Assets to a Remote Server
    • Embeds
      • Embeds
      • Embedding an Airkit Experience on your Website
      • AirClient Configurable Properties
    • Portals
      • Portal Capabilities
      • Portal Data Grids
      • Running Data Flows from a Data Grid Portal Page
    • Publishing
      • Publishing Your Application
      • Editing an Application
      • Importing and Exporting an Application
      • Using Profiles for Deployment settings and Configurations
      • Promoting Variables to an App Setting
    • Analytics
      • Journey Analytics
      • Reporting
      • View Past Journeys with Activity Explorer
      • Setting up Analytics with Google Tag Manager
      • Setting up Analytics with Heap
      • Analytics Schema
    • Advanced
      • Custom Controls
    • Authentication
      • SAML Authentication
  • Airscript
    • What is Airscript?
    • Airscript Quick Start
    • Airscript Examples
    • Advanced Airscript Examples
    • Testing Airscript Expressions
    • Working with Text in Airscript
    • Working with Numbers and Currency in Airscript
    • Working with Date, Time and DateTime in Airscript
    • Working with Email and Phone Numbers in Airscript
    • Working with Missing Values with Airscript
    • Encoding in Airscript (URLs and Base64)
    • Filtering Data using Query Expression
    • Querying Lists (Arrays) and Objects (JSON) in Airscript
    • Date and Time Formatting Options
    • Time Unit Values
    • Supported Time Zones
  • Customizations
    • Phone Numbers
    • Custom Domains
    • Connecting Your Domain to Airkit
    • Styling
      • Styling with Themes
      • Working with Themes and Control Variants
      • Importing and Exporting Themes
      • Working with Custom Fonts
      • Creating an App Header
  • Administration
    • Configuring SSO Access for an Organization
    • Managing User Roles
    • Adding Users to Airkit
    • Airkit Organizations
    • Environments
  • Error Management
    • Configuring App Error Notifications to Slack
    • How to Log a Custom Event Error and send an Email Notifier
  • Security and Compliance
    • IP Ranges
    • Encrypting Data
    • App Security FAQ
    • TCPA
    • How To enforce TCPA
  • airscript-functions
    • Text Functions
      • CAPITALIZE
      • CONCAT
      • ISSTRING
      • LOWERCASE
      • PADSTRING
      • REPLACE
      • REPT
      • SPLIT
      • STRING_COMPARE
      • STRING_FIND
      • STRIP
      • SUBSTITUTE
      • SUBSTRING
      • TITLECASE
      • TRIM
      • UPPERCASE
    • DateTime Functions
      • ADD_TO_DATETIME
      • DATE
      • DATETIME
      • DATETIME_DELTA
      • DATETIME_FROM_FORMAT
      • DATETIME_FROM_TIMESTAMP
      • DATE_DELTA
      • DATE_FROM_DATETIME
      • DATE_FROM_FORMAT
      • DAY
      • DAYS
      • FORMAT_DATE
      • FORMAT_DATETIME
      • FORMAT_TIME
      • HOUR
      • ISO_WEEK
      • MINUTE
      • MONTH
      • NOW
      • SECOND
      • SUBTRACT_FROM_DATETIME
      • TIME
      • TIMESTAMP_FROM_DATETIME
      • TIME_DELTA
      • TIME_FROM_DATETIME
      • TIME_FROM_FORMAT
      • TODAY
      • UPDATE_DATE
      • UPDATE_DATETIME
      • UPDATE_DAY
      • UPDATE_HOUR
      • UPDATE_MILLISECOND
      • UPDATE_MINUTE
      • UPDATE_MONTH
      • UPDATE_SECOND
      • UPDATE_TIME
      • UPDATE_TIMEZONE
      • UPDATE_YEAR
      • WEEK
      • WEEKDAY
      • YEAR
    • List Functions
      • CONTAINS
      • FIRST
      • FLAT
      • JOIN
      • LAST
      • LENGTH
      • SHUFFLE
    • Object Functions
      • KEYS
      • VALUES
      • MERGE_OBJECTS
    • Math Functions
      • ABS
      • ACOS
      • ACOSH
      • ACOT
      • ACOTH
      • ASIN
      • ASINH
      • ATAN
      • ATAN2
      • ATANH
      • CEILING
      • COMBIN
      • COMBINA
      • COS
      • COSH
      • COT
      • COTH
      • CSC
      • CSCH
      • DEGREES
      • EVEN
      • EXP
      • FACT
      • FACTDOUBLE
      • FLOOR
      • GCD
      • ISEVEN
      • ISNUMBER
      • ISODD
      • LATLNGDISTANCE
      • LCM
      • LN
      • LOG
      • MAX
      • MIN
      • MROUND
      • MULTINOMIAL
      • ODD
      • PI
      • POWER
      • PRODUCT
      • RADIANS
      • RANDOM
      • RANGE
      • ROUND
      • ROUNDDOWN
      • ROUNDUP
      • SEC
      • SECH
      • SIGN
      • SIN
      • SINH
      • SQRT
      • SQRTPI
      • SUM
      • SUMSQ
      • TAN
      • TANH
      • TRUNC
    • Conditional Functions
      • IF
      • ISEMPTY
      • ISNOTEMPTY
      • NOT
    • Currency Functions
      • CURRENCY
      • FORMAT_CURRENCY
      • PARSE_CURRENCY
    • Phone Functions
      • FORMAT_PHONE
      • ISPHONE
      • PARSE_PHONE
    • Email Functions
      • ISEMAIL
    • Number Formatting Functions
      • ARABIC
      • FORMAT_NUMBER
      • PARSE_NUMBER
      • ROMAN
    • Data Type Functions
      • FROM_JSON
      • TO_JSON
      • TYPEOF
    • Asset Functions
      • ASSET_SIZE
      • ASSET_STATE
      • ASSET_THUMBNAIL_URL
      • ASSET_TO_URI
      • ASSET_TYPE
      • URI_TO_ASSET
    • Encoding Functions
      • BASE
      • BASE64_DECODE
      • BASE64_ENCODE
      • HMAC_MD5
      • HMAC_SHA1
      • HMAC_SHA256
      • MD5
      • SHA1
      • SHA256
      • URL_DECODE
      • URL_ENCODE
      • VALUE_OF
    • Arithmetic Operators
      • Addition (+)
      • Subtraction (-)
      • Multiplication (*)
      • Division (/)
      • Remainder (%)
    • Comparison Operators
      • Equality (=)
      • Inequality (<>, !=)
      • Ordering (<, <=, > , >=)
    • User Defined Functions
      • User Defined Functions
      • Creating a new User Defined Function
  • Web Controls
    • Web Controls Overview
    • Common Style Properties of Web Controls
    • Button
    • Button Cell
    • Checkbox
    • Checkbox Cell
    • Checkbox List
    • Container
    • Credit Card
    • Currency Input
    • Date Picker
    • Dropdown List
    • Email Input
    • Embedded External Content (Container)
    • File Upload
    • Form Container
    • Hyperlink
    • Image
    • Label
    • List
    • Map
    • Media Upload
    • Number Input
    • Payment Request Button
    • Phone Input
    • Place Search Input
    • Progress Bar
    • Radio Button
    • Radio Button List
    • Radio Cell
    • Scheduler
    • Secure String Input
    • Signature
    • Simple Cell
    • Text Area
    • Text Input
    • Web Flow
    • Web Page
  • Voice and Chat Controls
    • Dialogue Controls Overview
    • Decision Menu
    • Forward Call
    • Secure Touchtone Capture
    • Text Response Capture
    • Touchtone Capture
  • Data Operations
    • Data Operation Overview
    • AirData Request
    • Calendar Search
    • Create File
    • Delete Assets
    • Download Encoded Asset
    • Fetch Asset Details
    • Fill PDF Form
    • Google
    • HTML to PDF
    • HTTP Request
      • Using an API With Paging
    • Journey Mapping
    • Merge PDF
    • Run Data Flow
    • Run Journey Event
    • Salesforce
    • Secure Value Retrieval
    • Send Email
    • SFTP
    • Swagger Schema Validation
    • Transform
    • Wait
    • XML to JSON
    • Zendesk
    • ZIP File
  • Actions
    • Analytics Identify
    • Analytics Send Event
    • Cancel Timer
    • Close Modal
    • Condition
    • Create Timer
    • End Journey
    • Extend Journey Expiration Time
    • Initialize Actor
    • Log Custom Event
    • Navigate To Web Flow
    • Navigate to Web Page
    • Open Modal
    • Reporting Metric > Count
    • Reporting Metric > Field
    • Reporting Metric > Start Timer
    • Reporting Metric > Statistic
    • Reporting Metric > Stop Timer
    • Run Data Flow
    • Run Data Flow Repeatedly
    • Run Event
    • Set Authentication
    • Set Identifier
    • Set Variable
    • Start Chat Bot
    • Start Voice Bot
  • Variable Data Types
    • Data Types Overview
    • Any (JSON)
    • Asset
      • Detailed Asset
    • Boolean
    • Currency
    • Date
    • DateTime
    • Email
    • List
    • Location
    • Null
    • Number
    • Phone
    • Place
    • Text
    • Time
    • Custom Data Types
  • Integrations
    • Genesys Widget Integration
    • Zendesk Integration
    • Salesforce Integration
    • Plaid Integration
    • Twilio Integration
    • Stripe Integration
    • Shopify Integration
    • Airtable Integration
    • Google Integration
    • SFTP Integration
    • Custom Integrations
  • Kitcloud Templates
    • Address Capture and Parsing Web Flow Template
    • AirData Delete Record Data Flow Template
    • AirData Find Records Data Flow Template
    • AirData Insert Record Data Flow Template
    • Airtable Create Data Flow Template
    • Airtable Delete Data Flow Template
    • Airtable Query Data Flow Template
    • Airtable Update Data Flow Template
    • App Store Icon Buttons Web Flow Template
    • Attach Image to Ticket (Zendesk) Data Flow Template
    • Authenticate with API Web Flow Template
    • Basic HTTP Request Data Flow Template
    • Basic Transform Data Flow Template
    • Capture Customer Info Web Flow
    • Close a Ticket (Zendesk) Data Flow Template
    • Collect Customer Satisfaction Score (CSAT) Web Flow Template
    • Collect Net Promoter Score Web Flow Template
    • Collect One-Time Payment (Multiple Methods) Web Flow Template
    • Collect One-Time Payment (Stripe) Web Flow Template
    • Communication Channel Opt-in Web Flow Template
    • Complete a Task (Salesforce) Data Flow Template
    • Contact Us Web Flow Template
    • Create a Task (Salesforce) Data Flow Template
    • Create Ticket (Zendesk) Data Flow Template
    • Custom Image Radio Button List Web Flow Template
    • Email Mailing List Sign-Up Web Flow Template
    • Email Verification with OTP Web Flow Template
    • Encrypt Content with PGP Data Flow Template
    • Find a Contact by ID (Salesforce) Data Flow Template
    • Find a Task by ID (Salesforce) Data Flow Template
    • Find a User by ID (Salesforce) Data Flow Template
    • Find All Tickets (Zendesk) Data Flow Template
    • Generate One-Time-Password Code Data Flow Template
    • HTTP Request with Form Data - Data Flow Template
    • Location Selection with Map
    • Log a Call (Salesforce) Data Flow Template
    • Lookup Time Zone by Zip Code Data Flow Template
    • Order Summary Web Flow Template
    • Product Picker Web Flow Template
    • Run Sub Data Flow - Data Flow Template
    • Send Web Flow Link Chat Bot Template
    • Social Media Icon Buttons Web Flow
    • Speech Bubble Web Flow Template
    • Terms and Conditions Acceptance with Signature Capture Web Flow Template
    • Transform with Query Data Flow Template
    • Upload Photos Web Flow Template
    • USPS Address Verify Data Flow Template
    • USPS Lookup City and State by Zip Code Data Flow Template
    • Verify Email Address with OTP Web Flow Template
    • Vertical Progress Bar Web Flow Template
    • Yes/No Question List (Airscript Dynamic List)
    • Yes/No Question List (Static)
  • Product Versions
    • Customer Experience Runtime (CXR) Overview
    • Release Cadence and Long Term Support (LTS)
    • CXR Upgrades and Migrations
      • 17.14
      • 17.13
      • 17.12
      • 17.11
      • 17.10
Powered by GitBook
On this page
  • Functions
  • Arithmetic Operators
  • Comparison Operators
  • Accessing Data within Collections
  • Creating Custom Airscript Functions

Was this helpful?

  1. Airscript

Airscript Quick Start

PreviousWhat is Airscript?NextAirscript Examples

Last updated 1 year ago

Was this helpful?

Airscript is the programming language provided by Airkit. It is designed to be a simple, but powerful programming language with a focus on data manipulation. It's by strategically combining Airscript with input from app users (or other , such as an external API) that you control the order, flow, and nature of the interactions between your Airkit apps and the outside world. Most commonly, this is done by with Airscript or by using Airscript to access or modify data via the , both of which parse any input in Airscript by default.

For a deeper dive into how to try out some Airscript expressions, check out .

Functions

Like most programming languages, Airscript makes extensive use of functions. You can find an alphabetical listing of the functions that Airscript supports on the page.

Arithmetic Operators

Airscript supports the standard arithmetic operators: addition (+), subtraction (-), multiplication (*) , and division (/), as well as remainder (%).

Comparison Operators

Equality

Airscript has a number of comparison operators. The equality operator (=), returns TRUE when two values are the same, and FALSE when they are not the same value. For example consider the following expressions:

2 = 2 => TRUE  
2 = 1 => FALSE  
"Airscript" = "Airscript" => TRUE  
"Airscript" = "airscript" => FALSE

Comparing two values of different type will always be FALSE, for example:

2 = "Airscript" => FALSE

It is important to be careful when comparing two complex values such as Objects, Lists, Dates, Times, Datetimes, and NULL. The result will only be TRUE if the two values are exactly the same rather than just similar. For example

Inequality

In addition to the equality operator Airscript also supports an inequality operator which is the opposite of the equality operator. The inequality operator can be accessed by the symbol <> as well as the symbol !=. To understand the inequality operator consider the opposite of our previous examples.

2 <> 2 => FALSE  
2 != 2 => FALSE  
2 <> 1 => TRUE  
2 != 1 => TRUE  
"Airscript" <> "Airscript" => FALSE  
"Airscript" != "Airscript" => FALSE  
"Airscript" <> "airscript" => TRUE  
"Airscript" != "airscript" => TRUE  
2 <> "Airscript" => TRUE  
2 != "Airscript" => TRUE

Ordering

Airscript supports the following ordering operators: greater than (>), greater than or equal (>=), less than (<), less than or equal (<=). The ordering operators can be used with Numbers and Strings. For numbers these operators compare the magnitude of the number. Consider the following examples:

1 < 2 => TRUE  
1 <= 2 => TRUE  
1 < 1 => FALSE  
1 <= 1 => TRUE  
1 > 2 => FALSE  
1 >= 2 => FALSE  
1 > 1 => FALSE  
1 >= 1 => TRUE

The ordering operators compare Strings lexicographically, consider the following examples:

"air" < "airscript" => TRUE  
"air" <= "airscript" => TRUE  
"airscript" < "airscript" => FALSE  
"airscript" <= "airscript" => TRUE  
"air" > "airscript" => FALSE  
"air" >= "airscript" => FALSE  
"airscript" > "airscript" => FALSE  
"airscript" >= "airscript" => TRUE

Comparing the order between two complex objects will always return FALSE.

Accessing Data within Collections

Object Property Access

Objects are a data type that relates field names to values. For example, an address in the United States is typically made up of a Street, City, State, and Zipcode. In Arikit an example of an Object holding such data might look like this:

{  
  street: "200 California Ave.",  
  city: "Palo Alto",  
  state: "CA",  
  zip: "94036"  
}

In order to access the street property, one would use dot notation:

({  
  street: "200 California Ave.",  
  city: "Palo Alto",  
  state: "CA",  
  zip: "94036"  
}).street

or, if the Object were stored in a variable named address:

address.street

List Access

Lists are a data type that store data in a particular order. Imagine we have a list of book titles, in Airscript it might look like this:

[  
  "The Little Schemer",  
  "The Seasoned Schemer",  
  "The Reasoned Schemer",  
  "The Little Prover",  
  "The Little Typer"  
]

A particular item can be accessed from a list by its numerical index in the list. Indices begin at the number zero, in other words, the first item in the list is accessed at index 0. In order to retrieve the book title "The Little Schemer" from our example you would do so like this:

[  
  "The Little Schemer",  
  "The Seasoned Schemer",  
  "The Reasoned Schemer",  
  "The Little Prover",  
  "The Little Typer"  
][0]

or, if the list were stored in a variable named books:

books[0]

Creating Custom Airscript Functions

Custom Airscript functions, defined in terms of established Airscript operators, can be defined in the . For a deeper diving into User Defined Functions, check out .

external sources
defining a variable
Transform Data Operation
Testing Airscript Expressions
Airscript Functions
Connection Builder
this article