Thanks Paul. I voted for the idea and added a comment to the idea.
Original Message:
Sent: 11-17-2023 11:02
From: Paul Simpson
Subject: Split a message into two variables
Jose, good solution!
FYI, the documentation implies there is a "ForEach()" loop construct, but in fact there isn't. You have to get the length of the collection and then loop through it the hard way.
There is an idea here to provide this functionality.
HTH
------------------------------
Paul Simpson
Original Message:
Sent: 11-17-2023 01:22
From: Jose Carlos Albor
Subject: Split a message into two variables
There are a few ways to do this. Here is what I would do...
- Task.Transcript = "I give the agent 5 thank you for your help"
- Update Data
- New Collection
- String
- Variable name: Task.TranscriptArray
- Value: [Expression] Split(Flow.Transcript, " ")
- You can now parse thru each object of the array...
- Example:
- Task.TranscriptArray[0]
- Task.TranscriptArray[1]
- Task.TranscriptArray[2]
- Task.TranscriptArray[3]
- Task.TranscriptArray[4]
- You can try and compile a Parse(Contains(Task.TranscriptArray, 0,1,2,3,4,5))
- I'm not entirely sure if this works. I know in PowerShell you can loop thru an array with a ForEach iteration. There may be a way for you to set a bool in there of true or false.
I quickly threw together this sample inbound flow, where I used several steps to compile a method to loop thru each word using the baked in loop function and leveraging the Object[Int] position to reference each word in the array. The loop counter and evaluation is very primitive, but does function by picking up an integer of AnyOneOfThese(0,1,2,3,4,5) from any position of the transcript array. Go ahead and publish it in your sandbox and call it, let me know if that was something you were looking for.
I an unable to upload .yaml or .i3InboundFlow file types into this forum, so after you download them, revert the file extension to the respective type before you review or import.
------------------------------
Carlos Albor
Senior Principal PS Consultant
Original Message:
Sent: 11-13-2023 05:53
From: Richard Dib
Subject: Split a message into two variables
Hey all,
We have deployed a post call survey via SMS, it writes the data back into a data table for us.
At the end of a call a SMS is sent out asking for a rating of 1 to 5, we are getting results back with some free text, example "5 thank you for your help"
Is there a way that i can get the numeric value entered into a column into our data table and the free text in another?
I looked at using Split(Message.Message.body, " ") but not sure how to add the free text into the second column.
thanks
#ArchitectureandDesign