I have not tried it with purely SmartForms, but it does seem possible with a workflow; however, there may need to be additional considerations in validating the data to ensure that it covers most use cases and user errors.
This works because the foreach loop will accept a semi-colon delimited list:
https://help.k2.com/onlinehelp/K2smartforms/UserGuide/4.7/default.htm#Thin_Client_Wizards/General_Wizards/For_Each/For_Each.htm?Highlight="Semi-colon%20delimited%20text"
Such that:
1231231
4342342
3423424
Can be manipulated to:
1231231;4342342;3423424
And then passed into the ForEach loop.
1. Pass this (newline separated list?) memo control into a data field on workflow start:
2. Add a Set Data Fields to manipulate this Data field so that it becomes semi-colon separated list:
3. Having this as a separate set data fields event will allow auditing of the data to see if there are any issues in the Viewflow:
* entries separated by newline are converted to semicolon list
* you can also use a totally seperate data field if you wish to preserve the initial values
4. This is done so with URLDecode(Replace(URLEncode(DataField),%0a,;))
* This is essentially URLEncoding the data field which changes the newline characters to "%0a", allowing us to use a replace function to replace "%0a" with ";", and then encoding the data again for good measure
5. Then in the ForEach loop, pass it this data field which is now 'semi-colon' delimited:
* Give it a reference name and index name; the reference here would be a reference to a single item (not the collection)
* I used an email event here, but if you can swap that with a SmartObject call in your use case
1. Some things we will likely need to consider are:
a. Does copying from Excel or other applications resulting in a newline separated encoding (I only tested with typing into the memo control and hitting the "Enter" key to create newline);
b. What happens if there is leading/trailing spaces or newline characters, hidden characters? Perhaps including some additional "Trim" line function and validation on the form and workflow
c. What happen if two newline exists, does it create a blank entry?
You rock!
I think this will work perfectly. Going to try it today.
Rob