Articles on: Flows

Split by Flow Result

Use this Split Action to evaluate a sequence of values separated by a space ( ), period (.) or plus sign (+).

As an example, you might record the birth of a child by soliciting messages in the following format: "birth [gender]+[name]+[mother's birth year]," which could yield the result "birth f+Noel+1985".

In the case above, the term "birth" acts as a keyword trigger, initiating the flow.

 In the following example, we create a flow that collects and evaluates a sequence of values, Gender, Name, and Mother's Birth Year.

After sending an initial message, create a Wait for Response action with an open-ended response rule has any of the words to collect messages directed to this flow via the "birth" keyword trigger. Save the result as "Message."

Note: This response rule must remain open-ended, as it will collect all messages that contain the keyword we've designated, "Birth". Once we've stripped the initial message of its keyword, we can go about evaluating each field using a series of Split by Flow Result actions.



Remove the keyword trigger to isolate the submission as the flow variable @results.message (Split by Flow Result actions may only evaluate flow results variables). To do so, create a Split Action that splits the initial message by expression. In the example pictured below, we apply the @(REMOVE_FIRST_WORD()) function to the incoming message (referenced using @input.text). The resulting expression should read @(REMOVE_FIRST_WORD(input.text)).

Save the resulting flow variable as "Fields" to yield only the values delimited by a plus sign. To review, the values we'll submit will follow the format [gender]+[name]+[mother's birth year]. Each bracket value is assigned its own field. Gender is the first field, Name the second, and Mother's Birth Year the third.




Add a Split by Flow Result action to evaluate Gender, the first field delimited by a plus sign. Create a response rule for each gender that categorizes the short form values "m" or "f" as their long form counterparts, and save the resulting flow variable as "Gender."




Note that you will need to click the "Advanced" tab at the top of the node to delimit your result for each of your Split by Flow Result actions:



Add a Send Message action that addresses incorrectly formatted "Gender" values and asks the contact to resubmit the message.




In the example pictured above, we've formatted the error message to repeat the contact's initial message using the @results.fields variable, so they can see how their response compares to the expected format, and ask them to resubmit.

Add a second Split by Flow Result action to evaluate "Name", the second field delimited by a plus. This time, it's the name of the child. You can create an "_is not empty_" response rule to ensure the second field has a value, then categorize it as "_Has Name_" and save the resulting flow variable as "Name." Again, be sure to check the Delimit Result box in the Advanced tab.




Add a Send Message action that addresses incorrectly formatted "Name" values and asks the contact to resubmit.




Add a third Split by Flow Result action to evaluate "Birth Year", the third field delimited by a plus. Add a "_has a number between_" response rule to ensure the third field contains a valid birth year and save the resulting flow variable as "Birth Year".



Add a Send Message action that addresses invalid "Birth Year" values and asks the contact to resubmit.




Finish the flow by adding a Send Message action that confirms the message form submission by referencing the values submitted by the contact.




The resulting flow should look similar to the example pictured below.



Need more than nine fields? Use the Split by Expression action and the following function: 

FIELD(text, index, [delimiter])

Reference a field in a string separated by a delimiter:

@(field(results.field, 1, "+"))

Updated on: 19/06/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!