cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Conversational AI How to Split a Variable

former_member731702
Participant
0 Kudos

I would like to separate a string from nlp.source according to a specific seperator. I tried the "{{split string separator}}" method specified in the SAP document and I did not get a positive result. How can I seperate the data I receive from the user? If you can help with this, I would be very happy.

Ex:

nlp.source = 12 - 13 - 112 - 24246

list = "{{nlp.source}}"

sepList = "{{split memory.list '-'}}"

memory.sepList.[0] = 12

memory.sepList.[1] = 13

....

JonasB
Contributor
0 Kudos

Hi Bekirhan,

this approach should work. You might in addition need to remove the spaces.

What is returned when you’re adding a text message with {{memory.sepList}}?

Regards

Jonas

Accepted Solutions (1)

Accepted Solutions (1)

Dan_Wroblewski
Developer Advocate
Developer Advocate

What about storing the NLP source in mystring (just for simplification), then setting the memory variable mystringlist this way::

{{json (split memory.mystring '-')}}

then you can reference each element like this:

VALUE: {{memory.mystringlist[2]}}

former_member731702
Participant
0 Kudos

Thank you for your valuable answer!

Answers (0)