Skip to main content
Home  › ... Razor

Formulas Tutorials

Tutorial HomeFormulas

Formulas using Parameters

Formulas with parameters or App Settings

We'll show you how to use page parameters with formulas

In this tutorial you'll learn how to:

  • Use emphemeral fields
  • Use data.parameters in your formulas new in v14

Important: Now using Formulas V2 🆕 in 2sxc 16

Formulas V2 has intellisense, stoppability, support for promises and more.

Try it:

This doesn't tell the form anything

    This tells the form to show advanced prefill:VarShowAdvanced=true

      This example uses an ephemeral field which is prefilled from the open-button.

      VarShowAdvanced is an ephemeral field and thus not saved in the database. This formula determines the visibility of the Advanced Settings group. The group becomes visible, when the VarShowAdvanced toggle is active.


      Click on the (Σ) button above to see the edit-UI with the formula.

      Formulas of FormulasEphemeral.AdvancedGroup

      Field.Settings.Visible (Formula-Target: Field.Settings.Visible)

      v2((data) => {
        return data.VarShowAdvanced == true;
      });

      Ephemeral (Non-Saving) Fields in Formulas

      Sometimes you need fields which controle the Form UI without being real data. Some examples:

      • Toggles which show/hide other fields or field groups
      • Hidden calculations which will consolidate other field values to determine if something else is required

      We don't want to save these fields as the data is not relevant, and often the value should be calculated upon opening the form - so it's important that they are reset.

      Create an Ephemeral field

      An Ephemeral field is just a normal field with an additional configuration. 

      To configure it, check out the picture. 

      Learn more about Ephemeral fields here.

      Configure edit form UI using parameters

      In 2sxc v15 we added data.parameters.* which contains all parameters given in the FormParameters.

      By passing parameters directly, edit forms can be configured without the need of additional Ephemeral fields. This enables a editing experience matching the page context.

      Error Showing Content - please login as admin for details.
      Error Showing Content - please login as admin for details.
      Error Showing Content - please login as admin for details.

       

       

      Error Showing Content - please login as admin for details.