Is there a way to split a context value ?? For instance if the value is 2BBA-757-000006-1234567890, can I split it into 4 sections at the hyphen?

Didn't find what you were looking for?

New post
Was this post helpful?
1 out of 1 found this helpful



  • Official comment

    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:



    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?



  • 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 school

  • Hi again Patrick,

    can you please send me a photo or a copy of this specific part in your context? 




Please sign in to leave a comment.