PhixFlow Help

8. Setting values in actions

In this chapter we will manipulate the data typed into the edit form - in this case, to ensure that phone number are stored with international format:

Update your app to apply this manipulation. To recap the steps in the video:

  • Open details for the action Validate Contact
  • Go to the section Update StreamItems section

Because we have set Copy Values by Name, we only need to add a rule for values we want to manipulate.

If Copy Values by Name was not ticked, we would need to set a rule for every value you want to save to the stream.

  • Open the list of stream attributes, and drag PhoneNumber into the list of stream item updates
  • Double click on the rule to open the details

Note that the default expression for the rule is:

_form.PhoneNumber

This is the value typed into the phone number field on the edit form, and therefore this simply copies the typed value into the stream.

This expression can use any field from the edit form (provided by _form), and any of the attribute functions, to set the value as needed.

  • Update the expression to replace a leading 0 with 44:
replaceFirst(_form.PhoneNumber, "^0", "44")
  • Save your changes to the stream item update rule

Go into App Mode. Update a record - you will see the leading zero replaced by 44. Because this action backs both the Add and Update buttons, this is also true for newly entered contacts.

Exercise

Update the rule to set phone numbers to start +44

To do this, you will need to edit the expression that sets the value, but also the validation expression - since currently this does not accept the + character.


Next chapter: 9. Screen flow



Please let us know if we could improve this page feedback@phixflow.com