FORMULA LANGUAGE
Examples: Concatenating, comparing, and determining length
1. (+). This example concatenates the two strings to form ABCDEF.
@Prompt([Ok]; "Concatenation"; "ABC" + "DEF")
2. (+). This example concatenates the two input strings.
Input1 := @Prompt([OkCancelEdit]; "Concatenation - first element"; "Enter any text in the box"; "ABC");
Input2 := @Prompt([OkCancelEdit]; "Concatenation - second element"; "Enter any text in the box"; "DEF"); @Prompt([Ok]; "Concatenation - result"; Input1 + Input2)
3. (=). This example returns True to YesNo if the two input strings are equal, False if they are not equal.
Input1 := @Prompt([OkCancelEdit]; "Comparison - first element"; "Enter any text in the box"; "ABC");
Input2 := @Prompt([OkCancelEdit]; "Comparison - second element"; "Enter any text in the box"; "DEF");
YesNO := @If(Input1 = Input2; "The strings are equal"; "The strings are not equal"); @Prompt([Ok]; "Comparison - result"; YesNo)
4. (@Length). This example displays 9, the length of abcdefghi.
@Prompt([Ok]; "Length of abcdefghi"; @Text(@Length("abcdefghi")))
5. (@Length). This example creates a number list. Each element of this list contains the length of the corresponding element in TextList.
@Length(TextList)
6. (@Matches). This example returns True to YesNo if Input equals abc.
Input := @Prompt([OkCancelList]; "@Matches Input"; "Choose one"; "abc"; "abc" : "bcd" : "cde" : "xyz" : "123");
YesNo := @If(@Matches(Input; "abc"); " matches abc"; " does not match abc"); @Prompt([Ok]; "@Matches Result"; Input + YesNo)
7. (@Matches). This example returns True to YesNo if every character in Input is alphabetic, that is, in the range a-z. The set {a-z} specifies the character range and the preceding + means any number of occurrences of the set.
Input := @Prompt([OkCancelList]; "@Matches Input"; "Choose one"; "abc"; "abc" : "bcd" : "cde" : "xyz" : "123");
YesNo := @If(@Matches(Input; "+{a-z}"); " matches +{a-z}"; " does not match +{a-z}"); @Prompt([Ok]; "@Matches Result"; Input + YesNo)
8. (@Matches). This example returns True to YesNo if every character in Input is not alphabetic, that is, is outside the set {a-z}. The specification {!a-z} means not in the set of characters a-z, and the preceding + means any number of occurrences of that set.
Input := @Prompt([OkCancelList]; "@Matches Input"; "Choose one"; "abc"; "abc" : "bcd" : "cde" : "xyz" : "123");
YesNo := @If(@Matches(Input; "+{!a-z}"); " matches +{!a-z}"; " does not match +{!a-z}"); @Prompt([Ok]; "@Matches Result"; Input + YesNo)
9. (@Matches). This Example returns True to YesNo if Input contains the characters bc in sequence surrounded by any number of any characters.
Input := @Prompt([OkCancelList]; "@Matches Input"; "Choose one"; "abc"; "abc" : "bcd" : "cde" : "xyz" : "123");
YesNo := @If(@Matches(Input; "*bc*"); " matches*bc*"; " does not match *bc*"); @Prompt([Ok]; "@Matches Result"; Input + YesNo)
10. (@Matches). This Example returns True to YesNo if Input starts with a and is three characters long or starts with 1 and is three characters long.
Input := @Prompt([OkCancelList]; "@Matches Input"; "Choose one"; "abc"; "abc" : "bcd" : "cde" : "xyz" : "123");
YesNo := @If(@Matches(Input; "a??|1??"); " matches a??|1??"; " does not match a??|1??"); @Prompt([Ok]; "@Matches Result"; Input + YesNo)
11. (@Like). This agent example checks for two sets of strings in the textBody field of each document. The first string is any text that contains "acquisition" and "Acme" in that order. The second string is any text that contains "Acme" and "51%" in that order. The second @Like statement uses the slash (/) as an escape character so the percent sign (%) can be specified. Don't use the backslash (\) as an escape character.
@If(@Like(textBody; "%acquisition%Acme%"); @Prompt([Ok]; "Found reference to \"acquisition\""; Subject); "");
@If(@Like(textBody; "%Acme%51/%%"; "/"); @Prompt([Ok]; "Found reference to \"51%\""; Subject); "");
SELECT @All
12. This action compares a list to the value "N" and displays the result. Boston and Moscow result in -1 (less than N), Tokyo results in 1 (greater than N), and n and N result in 0.
list := "Boston" : "Tokyo" : "Moscow" : "N" : "n";
result := @text(@compare(list; "N"; [CaseInsensitive]));
@Prompt([OkCancelList] : [NoSort];
"Result"; ""; ""; list + " (" + result + ")")
See Also
Concatenating, comparing, and determining length
Glossary
Feedback on
Help
or
Product Usability
?
Help on Help
All Help Contents
Glossary