• Resolved benlashley80

    (@benlashley80)


    hello, I have a field that calculates users age using the following code:

    DATEDIFF(TODAY(), fieldname243 , 'yyyy-mm-dd','y') ['years']

    this displays -1 before the user selects their birthday. how can I set the calculated field to be blank until the birthday is selected? thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author CodePeople2

    (@codepeople2)

    Hello @benlashley80

    You must ensure the field is not empty before generating the output:

    IF(fieldname243|r, DATEDIFF(TODAY(), fieldname243 , 'yyyy-mm-dd','y') ['years'], '')

    Best regards.

    Thread Starter benlashley80

    (@benlashley80)

    thank you for the reply!, what is the “| r”?

    Plugin Author CodePeople2

    (@codepeople2)

    Hello @benlashley80

    There are no space characters (fieldname243|r). The plugin works as follows:
    It takes the equations and replaces the fields’ names with their corresponding values, but preprocesses them first to be used in mathematical expressions, etc. Additionally, the plugin supports the modifiers (the modifiers modify the plugin’s default behavior).

    Currently, there are three modifiers:

    |r allows you to access the raw field’s value, without preprocessing, e.g., fieldname243|r

    |n tells the plugin you are referring to the field’s name directly instead of its value, e.g., ACTIVATEFIELD(fieldname1|n);

    |v only supported by radio buttons, checkboxes, and dropdown fields. In these controls, you can decide between submitting the choices’ texts or values, the |v modifier tells the plugin you are referring to the information that would be submitted. If you have configured the field to submit the choices’ texts, the fieldname1|v allows you to access the selected choice text from the equation instead of its value (by using simply fieldname1, you would be accessing the selected choice’s value).

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘age calculation default input’ is closed to new replies.