Mind Expression Docs
English
  • Mind Expression Docs
  • Why Mind Expression
  • Quickstarts
    • Create Scope
    • Add Subject
    • Test
    • Audit
  • Concepts
    • Scopes
    • Subjects
    • Components
    • Sandbox
    • Conversation history
    • Webhooks and escalation
    • Knowledge
    • Live Chat
    • Target Messages
    • Analytics
  • How-to Guides
    • Set up webhooks and escalation
    • Manage global keys
    • Customize messages
    • Educate AI
      • Manage ontologies
      • Recognition Check
      • Semantic Relations
      • Manage entities
    • Steps
    • Components
      • Normal Components
        • Conditions
        • Selection Classes
        • Parameter Bundles
      • Response Components
        • Component Actions
    • Build Q&A Subjects
      • Case 1. Online Payment
      • Case 2. Data Plans
    • Build Info Search Subjects
      • Case 1. Data Usage
      • Case 2. Payment History
    • Build Query Freestyle Subjects
      • Case 1. Data Purchase
      • Case 2. Change Mobile Plan
    • Intelligent Process
      • Introduction to Mindscript
      • Mindscript with Mind Expression
      • Frequently Asked Question
      • Package: Collections and Sequenceable
      • Package: Collections Unordered
      • Package: Collections-Strings
      • Package: Engine-Conversation
      • Package: Kernel-HTTP
      • Package: Kernel-Methods
      • Package: Kernel-Numbers
      • Package: Kernel-Dates
      • Package: Kernel-Objects
      • Package: Kernel Exceptions
      • Package: Cryptography
    • Test and debug
    • Integration
      • Mind Expression API
      • Chat Widget
      • LINE
      • Facebook Messenger
      • Viber
      • Instagram
      • Discord
      • WhatsApp
      • Google Sheet
        • Google Sheet Webhook
      • Google Calendar
        • Google Calendar Webhook
        • Google Calendar: Use Cases
    • Audit AI Activities
    • Live Chat
    • Target Messages
    • Back up, import and restore Scopes
  • Reference
    • Glossary
    • API Docs
Powered by GitBook
On this page
  • MindScript Container
  • Cheat sheet reference for SQL functions

Was this helpful?

  1. How-to Guides
  2. Intelligent Process

Mindscript with Mind Expression

MindScript Container

We provide support for rendering code within a container environment.

To indicate code to be rendered, it should be enclosed within {{$ and }}. For instance, if the response-template field in a subject definition contains the following content:

A new format of it is {{$ sel dateFormat: 'MM/DD/YYYY'}}

If the sel is applied to the most recent input from the user, which is the query '2022-09-09', it would result in the displayed text.

A new format of it is 09/09/2022

That means, we interpret sel dateFormat: 'MM/DD/YYYY' as a MindScript code.

You can find the available MindScript classes and methods documentation for a container through the engine API at /public/v1/talk/documentation.

In addition to the engine API, this handbook provides documentation for all MindScript classes and methods.

Cheat sheet reference for SQL functions

SQL Function
MindScript method
Description
Example

ABS

abs

returns the absolute value of a number

ab := -243.2 abs.

CAST

asInteger

to change the data type of a value into the other type.

'123' asIntger.

asNumber

'12.2' asNumber.

asString

12 asString.

REPLACE

replaceAll: with:

replace all occurrences of a string

ch := 'This is a string' replaceAll: 'is' with: 'was'. "ch = Thwas was a string"

CHARINDEX

findString:

locate the beginning position of a substring in a string

position := 'This is a string' findString: 'is'

findString: startingAt:

position := 'This is a string' findString: 'is' startingAt: 2.

FORMAT

asCustomNumber:

formats a value with the specified format

123456789 asCustomNumber: '##-##-#####'. "12-34-56789"

LEFT

left:

extracts a number of characters from a string (from left)

str := 'abcdefg' left: 5. "str = abcde"

RIGHT

right:

extracts a number of characters from a string (from right)

ri := 'abcdefg' right: 5. "ri = cdefg"

LEN

size

returns the length of a string

length := 'W3Schools.com' size. "length = 13"

LOWER

asLowercase

Convert the text to lower-case

lw := 'A string' asLowercase. "lw = a string"

UPPER

asUppercase

Convert the text to upper-case

up := 'A string' asUppercase. "up = A STRING"

LTRIM

trimLeft

Remove leading spaces from a string

tl := ' A string' trimLeft. "tl = A string"

RTRIM

trimRight

Remove trailing spaces from a string

tr := 'A string' trimRight. "tr = A string"

SUBSTRING

copyFrom: to:

extracts some characters from a string

substr := 'abcdefg' copyFrom: 1 to 5. "substr = abcde"

FLOOR

floor

the largest integer value of a number

fl := 25.75 floor. "fl = 25"

RAND

Random

a random number between 0 (inclusive) and 1 (exclusive)

ran := Random between: 0 and: 6. "ran >= 0 and: rand < 6"

ROUND

asCustomNumber:

rounds a number to a specified number of decimal places

(234.414 asCustomNumber: '0.00') asNumber. "234.41"

DATEDIFF

dateDiff: as:

find the difference between two dates

dy := '2017/08/25' dateDiff: '2019/08/25' as: #year. "dy = 2"

DATEADD

dateAdd: as: format:

adds a time/date interval to a date and then returns the date

date := '2017/08/25' dateAdd: 2 as: #month format: 'YYYY/MM/DD'. "date = 2017/10/25"

DATEPART

dateFormat:

a specified part of a date

yyyy := ('2017/08/25' dateFormat: 'YYYY') asInteger. "yyyy = 2017"

DAY

dateFormat:

the day of the month (from 1 to 31) for a specified date

dd := ('2017/08/25' dateFormat: 'DD') asInteger. "dd = 25"

MONTH

dateFormat:

the month part for a specified date (a number from 1 to 12)

mm := ('2017/08/25' dateFormat: 'MM') asInteger. "mm = 8"

YEAR

dateFormat:

the year part for a specified date

yyyy := ('2017/08/25' dateFormat: 'YYYY') asInteger. "yyyy = 2017"

GETDATE

dateFormat:

the current database system date and time

now := 'now' dateFormat: 'YYYY-MM-DD'. "now is a date string of now"

PreviousIntroduction to MindscriptNextFrequently Asked Question

Last updated 1 year ago

Was this helpful?