Answered
Split Context data

Didn't find what you were looking for?
New post-
Official commentAlexander Teusz (Cognigy)
Hi Patrick,
Thank you for your request. In order to manipulate the Cognigy Context, you make use of the Code Node in your flow. This node provides JavaScript support and thus String functions to solve your problem:
Example:
let oldValue = context.value; // "2BBA-757-000006-1234567890"
let newValue = context.value.split("-"); // ["2BBA", "757", "000006", "1234567890"]Now you created a list of all the different parts. There, you can access them with the following:
{{context.newValue[0]}} // The first value of the list -> 2BBA
Does this help you?
Best
Alex -
Patrick ONeill
My data is stored in cc.results.serial.value
So I did the following in the code node
let oldValue = cc.results.serial.value;
let newValue = cc.results.serial.value.split("-");
However I got no results from this , I am sure I got the context incorrect, I haven't used JavaScript since high school0 -
Alexander Teusz (Cognigy)
Hi again Patrick,
can you please send me a photo or a copy of this specific part in your context?
Thanks
Alex0
Please sign in to leave a comment.
Comments
3 comments