What are multiple variables example? Do they belong to the same group of data?
List and listformat
The best way to write multiple lines in one go is to use list variable. You can add the variable needed and later when write to file, use the listformat. Example
Code: Select all
a = "The answer to the universe is 42";
b = "1 + 2 = 3";
c = "abcdefghi";
write = newList(a, b, c);
In the
write to file action, put this as the text
{write,listformat}
It will create the text as
The answer to the universe is 42
1 + 2 = 3
abcdefghi
Uniform data
Most of the time, the data is uniform, so we can simply just use addElement() instead. Example concept from my battey logger flow. Each periodic check will get some information and add it to a global variable list type (which I have created before)
Code: Select all
row = "{triggertime}\t{battey_level}\t{battery_charger_counter}\t{battery_voltage}\t{battery_current_now}\t{battery_temperature}\t{battery_status}";
addElement(global_battery_log, row);
After adding to the glovar for the whole charging session, I can then export the logged variable from list to a string using listformat in the
Write to File Action
{global_battery_log,listformat}
The result is something like this.
1529025661869 1 160233 3574 -1523436 380 2
1529025667857 1 163215 3574 -1991209 380 2
1529025673866 1 166583 3574 -1985838 380 2
1529025679865 1 169920 3574 -1944334 380 2
Concatenate as you go
Other concept can be concatenate the variable as you go. You can start from blank variable and concatenate each one as you continue down the script.
Code: Select all
msg = "";
a = "Hello World";
msg = msg + a + "\n";
b = "This is my first sentence";
msg = msg + b + "\n\n";
c = "===============";
msg = msg + c;
Will show you
Hello World
This is my first sentence
===============