How to formulate statements when using strings of characters, variables or the newline character \n in "Expression" in DS?

Follow

Follow the 4 rules below. 

 # Rule  Content
 ①  Constants (without special characters)

Surround with >><< strings of characters that do no include an end-symbol << or a backlash \, to transform them into fixed text

 ②  Constants (with special characters)

Surround them with "" (double quotation) as the newline character \n includes the backlash character \

 ③  Variables

Because variables are fluctuating characters with output values changing along with the values stored in them, only write their names without surrounding them with >><< or "".

 ④  Connections of texts

By using + (concatenation/addition), you can connect values such as strings of characters, variables or newline characters \n.

 

Please refer to the examples below.

(Example) I want to use strings of characters, variables and a newline character in a "Send Email" step to output the following message:

Hello, Mr. Suzuki
I am Tanaka

[prerequisite]
Use two variables, [name] and [name2], with a short text attribute and store [Mr. Suzuki] in the first and [Tanaka] in the second.

 

By following the rules above, and writing an expression as below in the "Message" area of a "Send Email" step, you will recreate the example that follows.

>>Hello, << + name + "\n" + >>I am << + name2

1.png

 

For the above input value, you can also select and enter special characters from the drop-down menu of the Expression button. Refer to what follows.


Surround "Hello" with >><<. ※①Apply the rule for constants (without special characters)

2.png

3.png

 

Select + in: Operators > Concatenation/Addition. ※④Apply the rule for connecting texts

4.png

5.png


Select the "name" variable because the following text "Mr. Suzuki" is stored in it.
※③Apply the rule for variables

6.png

7.png

Select + in: Operators > Concatenation/Addition. ※④Apply the rule for connecting texts

 

Surround the newline character \n with a double quotation "". ②Apply the rule for constants (with special characters)

8.png


You can select the newline character \n from Special Characters > Linebreak: \n

9.png

10.png


Select + in: Operators > Concatenation/Addition. ※④Apply the rule for connecting texts

Surround "I am" with >><< ※①Apply the rule for constant (without special characters)

11.png


Select + in: Operators > Concatenation/Addition ※④Apply the rule for connecting texts

Select the "name2" variable because the following text "Tanaka" is stored in it. ※③Apply the rule for variables

12.png

 

13.png

 

Please refer to Method to combine variables and strings of characters inside a formula in DA, for a method to combine and enter strings of characters and variables in DA.

 

 

Notes

In DS and DA, not only is it possible to use \n as a the newline character, but also \r.
    Please also keep in mind Chromium requires the use of r\n\ as the newline character.

 Below are the newline characters you can use for DS, DA, and Chromium.

 DS:「\r\n」「\r」「\nare usable
 DA:「\r」「\nare usable ※「\r\nis also usable but it is recognized as two newline characters
 Chromium:「\r\n」「\rare usable

5 out of 5 found this helpful

Comments

0 comments

Article is closed for comments.