How to Iterate through a string list?
Issue #263
resolved
Is it possible to iterate through a string list in a post function. For example, how could I iterate through a string list of usernames, and append each to a multi line custom text field? Your help would be greatly appreciated!
Comments (4)
-
reporter -
repo owner Yes, you can do it using "Copy a parsed text to a field" in advanced parsing mode. I show you an example similar to what you intend to do:
Text to be parsed is:
toString(textOnStringList(["Phillip", "Susan", "Mary"], ^% + " was born on " + dateTimeToString(nthElement([2011-03-25 23:30, 1981-08-23 12:00, 2015-08-25 19:00], indexOf(^%, ["Phillip", "Susan", "Mary"])), LOCAL, SERVER_LANG)))
And this is the result you obtain:
In the former example the lists are literals:
- The string list is ["Phillip", "Susan", "Mary"]
- The number list containing dates is [2011-03-25 23:30, 1981-08-23 12:00, 2015-08-25 19:00]
But you can apply the same solution on any pair or string and number lists. You will need to ensure that the number lists contain at least as many elements as the string list.
-
reporter Perfect! Thanks Fidel!!!!
-
repo owner - changed status to resolved
- Log in to comment
Another example,
I have two lists; A = usernames in a Multi-User List B = list of dates, one for each user in A
Output to a multi-line text field each user and date like this; John Doe 03/09/16 3:45 PM Jane Smith 03/10/16 2:51 PM