01-24-2022 07:19 PM
Wondering if Workato has the concept of String Interpolation similar to C# where you can assemble multiple strings into one string.
For example, I have the need to create a text string that says:
"Your Part is: ABC123, Red Widget, and it will deliver on Feb 1 2022"
This is made up of three variables PartNum, PartDesc, and DelDate.
I know that I could use a formula such as:
"Your Part is: "+PartNum+", "+PartDesc+", and it will deliver on: "+DelDate
BUT.. in C# and other languages there is the concept of String Interpolation. The above could be written like this:
"Your Part is: {0}, {1}, and it will deliver on: {3}",PartNum, PartDesc, DelDate
Is this a thing in Workato Forumlas?
01-24-2022 08:05 PM
ANSWER! Yes you can... RUBY does have the concept of String Interpolation (see http://ruby-for-beginners.rubymonstas.org/bonus/string_interpolation.html
To test this, i did the following in a string variable setting formula: (as seen in the attached image). The result was "My Name Is Tim Shoemaker and my email address is tshoemaker@epicor.com"
This makes the assembly of long text messages easier because you don't need all those quotes and plus signs.
01-24-2022 08:17 PM
Yes, that's also doable:) you can also add "present ? <true datapill> : <false data>" construct to handle nulls
01-25-2022 12:24 AM
01-25-2022 02:01 AM
Hi Tim, string interpolation and string format are supported.
More examples: https://app.workato.com/recipes/2111405
01-25-2022 02:56 AM
This is useful when you need to apply formulas to the datapills before you form the string. Otherwise, Kirill Krivonos solution of dragging datapills to text mode would be ideal