Transforming data for other uses

Last updated on November 22, 2024

Some data is "masked" to present it in a standard format. If you want to ensure that the data stays in this format, you'll need to transform it.

On this page:

Masked data

The following controls (fields) mask data:

  • CA Phone Number
  • CA Postal Code
  • CA Soc. Ins. Num.

Masked controls generally:

  • Accept data entry
  • Validate it based on type, characters, or pattern
  • Clean it by removing extra characters like spaces and dashes
  • Apply a visual format to the remaining data

Masked controls store and transmit the cleaned entered data. It is otherwise unchanged.

To see how these controls handle data, see:

Transforming masked data

There are ways to re-use masked data when combining text and data, but this is limited to 'digital' outputs.

You'll want to actually transform this data when you want to:

  • Transmit formatted data to another system through an API or action
  • Ensure the format is retained in other outputs, such as PDFs

To transform a control's data:

  1. Create a new plain text field
  2. Open the settings and give the control a name
  3. Navigate to the Formulas tab
  4. Copy the appropriate code below
  5. Paste it into the Calculations section
  6. Change "controlName" to the name of your reference (original) control
  7. Apply any other settings you like, such as visibility
  8. Click Apply

The code below uses the concat() function to:

  • Copy the original, cleaned data
  • Separate the elements
  • Change the case of the characters (for the postal code)
  • Insert the needed characters to reproduce the format

The result is that the data collected and cleaned is now transformed into the desired format, allowing the new control to be used more-readily in multiple situations.

CA Phone Number

concat(
   '1-',
   substring($controlName, 1, 3), '-',
   substring($controlName, 4, 3), '-',
   substring($controlName, 7, 4)
)

CA Postal Code

concat(
   upper-case(substring($controlName, 1, 3)), ' ',
   upper-case(substring($controlName, 4, 3))
   )

CA Social Insurance Number

concat(
   substring($controlName, 1, 3), ' ',
   substring($controlName, 4, 3), ' ',
   substring($controlName, 7, 3)
)