twilioliquidliquid-templatetwilio-flow

Twilio Liquid Template cant access array


I am running into an issue where i use {{flow.data.Schedule | split:"~"}} to create an array with the variable name "schedule". I am trying to access the first value in the array but using {{flow.variables.schedule[0]}} and it comes out as nothing. enter image description here

edit:

according to the logs it doesnt look like its creating the array after I use the split. "schedule": "Monday through Friday from 12:30 AM to 1:00 AM Monday from 3:00 PM to 4:00 PM and Wednesday from 1:00 PM to 2:00 PM",

when original value has a "~" in the middle of that. the split removes it but doesn't seem to create an array.

edit 2:

I tried with a normal string "What~are~you" and in the logs its shows as "Whatareyou" after the split. I think the split function is not working as I expect?


Solution

  • The split function cannot be used inside the set variable widget.

    Example inside a say/play:

    Hello, {% assign array = flow.variables.schedule | split: '~' %}

    {{array[0]}}