USE CASE: I have a text area where the user can input several words, each separated by a semicolon. They would click a button that takes each word and adds it to a new row in a repeater. Essentially, this is bulk adding semi-colon separated values as a data set into their own rows.
I’m guessing the trick is how to identify a word up to a semicolon using indexOf(), however I can’t figure out how to loop it so that it reads the next value, and so on until the end. I’ve got a hacky way, but i can only get it to work for up to a few values. Any ideas?
The only way to loop in Axure is recursively: you fire the event that triggers the whole process.
Here is some pseudocode
OnClick (of button that adds to repeater)
If field contains a semicolon
grab the text up to (but not including) the first semicolon
add that text to a repeater row
remove that portion of the text from the field (including the semicolon)
fire the OnClick event of this button (to cause it to run again)
Else if the field is not blank
// there are no more semicolons because the test above failed,
// but the field still isn't blank, so this is the last segment
grab the remaining text from the field
add that to a repeater row
delete the remaining text in the field
The string functions are mostly just repurposed javascript functions, so just google “javascript” followed by the function name to see how to use it.
wow, I can’t believe I didn’t even think to fire the onClick conditional to loop it. This’ll definitely do it. Thanks so much! (and thanks for the pseudocode - super easy to follow!)