Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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:

Widget Connector
width900
urlhttps://www.youtube.com/watch?v=hiU4WBIAMNM&list=PLbPt6SI1Zhb_n3lXboTC_Qzq0Kg2x8LtT&index=10
height500

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
Note

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

Note that the default expression for the rule is:

Code Block
_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:
Code Block
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.

Panel
bgColor#D2F0FA
titleExercise

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.


Panel

Next chapter: 9. Screen flow