Jump to content
  • 0

LEN and other SQL operators


Sam23

Question

Is it possible to use LEN to get the length of a field in a caspio trigger? I am using this in a calculated field to determine when to execute a statement, but now would like to do that from a trigger.

Thanks,

Sam

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hello @Sam23,

First of all, the functions to work with strings can be found under the green ‘Text’ section:

XVAhdrL.png

 

 LEN() function

Syntax: LEN(string)

Syntax in Triggered Actions/Tasks: image.png.c220505d83ef038511b78d76a8d2f481.png

Analog of syntax on DataPages/in Formula field: LEN([@field:Email])
Return Type: Integer
Function description: The LEN() function is used to provide the number of characters in a string. Trailing spaces at the end of the string are not included when calculating the length. However, leading spaces at the start of the string are included when calculating the length.

Example of use case: count the number of characters in the submitted email address.
ZyqpjrY.png

Link to comment
Share on other sites

  • 0

LEFT() function

Syntax: LEFT(string, number_of_chars)

number_of_chars passed to the function must be a positive number.

Syntax in Triggered Actions/Tasks: image.png.86b3288c921baa1790bc9b2e79544b37.png

Analog of syntax on DataPages/in Formula field: LEFT([@field:Status], 2)

Return Type: String

Function description: The LEFT() function extracts a number of characters from a string (starting from left).

RIGHT() function

Syntax: RIGHT(string, number_of_chars)

number_of_chars passed to the function must be a positive number.

Syntax in Triggered Actions/Tasks: MU9QDcX.png

Analog of syntax on DataPages/in Formula field: RIGHT([@field:Status], 5)

Return Type: String

Function description: The RIGHT() function extracts a number of characters from a string (starting from right).

Example of use case: Create a Unique_Username that will be used as a Composite Key and which consists of the first character of the user First_Name, the last character of the user Last_Name, and the User_Pin value.
XSBMmnS.png

 

As for the MID() function, it looks like it is used in Excel to get a part of the string. In SQL it is the SUBSTRING() function.

SUBSTRING() function

Syntax: SUBSTRING(string, start, length)

start - The start position. The first position in the string is 1. Can be a negative number.

length - The number of characters to extract. Must be a positive number.

Syntax in Triggered Actions/Tasks: Vct7VPM.png
                                                                        OR Cn4yDGg.png

For ‘substring between’ the start value is included in the extracted substring, but the end value is not included.
For example, when extracting between 1st and 4th characters, the 4th character is not included:
KXygmoe.png

Analog of syntax on DataPages/in Formula field: SUBSTRING([@field:String], 3, 2)

Return Type: String

Function description: The SUBSTRING() function returns part of a string according to the start position and length provided.

Example of use case: Extract the third and fourth characters from the string․
5VQM8jX.png

 

Please note that all these functions are available within one block,  just need to select them from the dropdown:
L3KwgSK.png

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...