Setting New Variables After Splitting Data

I have a data table that I have comma separated data in(dollars/cents) that needs to be read back to the caller. After using Split("Flow.CustomerAmountOwed",","), how do I go about assigning a variable to each one? I will only have 3 values in the table column.


If you simply have a 3 part collection, just use an Update Data object for a string collectionvariable and your split statement, e.g.
Split(Flow.CustomerAmountOwed,",")

image

Then access each in the Audio prompt with actual position, e.g.
Task.SplitValues[0] , Task.SplitValues[1] (Starts at 0)

You can also loop over collections if needs to be more dynamic on sizing. You can use currency collections, there are many options.

Simon

Thank you for the info Simon! In your screenshot, I see that the values you have there are more of less hard coded. What if the values are dynamic in a data table? I'm using Flow.SplitValue in this instance, but when trying to reference Flow.SplitValue[0] it does not see it. Directly below is updating the data.


Below is trying to reference it off of a menu.

Hello,

You have not used the right type for your variable. It seems to be of type "String".
The example shown by Simon leverages a variable of type "String Collection".

Regards,

I was starting to change the way I'm pulling and whatnot. This is what I currently have. Sorry, this is my first time trying to set this kind of data to play back in one column.


I'm not sure what I need to put in the update data in order to separate the 3. I'm also trying to use an expression for the loop count but not working.

It will allow me to play the whole collection, but not the individual amounts in currency.

You are not using the right type for your variable.

When you define a new variable name, using the Update Data action, select the "Create collection" checkbox. It will then display collections types: String Collection, Integer Collection.
Select String Collection (for your Flow.PaymentCollection).

Thank you for your help Jerome, I was completely overlooking that. I was able to create String Collection and got it all set up. It is successfully playing back the 3 amounts I have the in the data table. My only issue is that it is not playing in currency format. When attempting to create a currency collection it gives the below error.
image

You can't declare a variable (Flow.CreditCollection) as a string collection (in your first update statement), and then try to define/use the same variable as Currency collection later on.
You need to define the variable with its type. Once it is defined with a type, it can't change its type.

You should have a look at the Expression Helper in Architect and get familiar with the available functions/methods.
You can't load the result of Split function into a Currency collection.
Split function will result in an array of String (a String Collection).

If you need to get to a variable of type Currency, you'll need to convert it via a function.
ToCurrency() is available - see Expression Helper.
It takes a string as parameter (it doesn't support a string collection). So you'll need to convert one by one.
ex: ToCurrency(Split(Flow.OutstandingCredits, "|")[0])

Regards,

I think I actually figured this out. A bit of trial and error. Not sure why the collections were throwing me for a loop. Thank you for all the help and information!!

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.