Get words in a list

Hi.

I use this to get userInput in a list:

(%ANY_WORD.SCRIPT )^{Variable1=_.getUserInputWords().collect{it}.join(’ ')}

My goal is;

Have this as a array with one word in each so I can use sublist and get one word at the time. And use offset to trigger the next word.

Hi Raquell,

I think you don’t need .join(' ') because it will give you a string instead of an array. Btw, you should add a backslash before the β€œ}” if you want to use curly brackets within a propagation script like this:
(%ANY_WORD.SCRIPT )^{Variable1=_.getUserInputWords().collect{it\}}

My goal is;
Have this as a array with one word in each

If we look at the documentation _.getUserInputWords returns an array of strings each containing a word from the input so you don’t need the collect{} call at all - the only difference it will make in this case is you will have a List instead of an array

Additionally if the intention is to parse/process the result (ie. lob.Variable1) somewhere else then you could call _.userInputWords directly where you want to use it, instead of having a match all lob and an attached script to extract it. User input data methods are available from all transactional global scripts after pre-processing and in listeners and flow nodes (see this table linked from the EngineAccess documentation above :grinning:)

1 Like