• Resolved saralanda

    (@saralanda)


    I have a calculated field that creates a string using text fields (fieldname9, fieldname4, and fieldname5) as input and then encoding the result so that the spaces are replaced with %20, etc. My code works and creates an encoded string (see code below):

    (function(){
    var transport = ”;
    if (fieldname9 != 0) {
    transport = ‘aaa Total guests: ‘ + fieldname9 + ‘aaa Pickup location: ‘ + fieldname4 + ‘aaa Destination: ‘ + fieldname5;
    }
    var encodedTransport = encodeURIComponent(transport);
    return encodedTransport;
    })();

    Two questions:
    1. When I reference this calculated field using fieldnameX in another calculated field, I only get shown ’20’. It completely ignores the letters before and after the first 20. How can I fix this?
    2. I want to store my result, encodedTransport as a global variable so that I can reference it elsewhere without having to call fieldnameX. How is this done?

    Thank you

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @saralanda

    Thank you so much for using our plugin.

    Our plugin tries to extract numbers from fields’ values to use them in mathematical operations. However, the use of modifiers allows you to access their raw values. In your case, you should use the |r modifier.

    If your calculated field is the fieldname123, you must refer to it in the second equation as fieldname123|r

    The current plugin version supports other two modifiers |n and |v.

    The |n modifiers tell the plugin you refer specifically to the field’s name instead of its value. The plugin replaces the fields’ names by their values in the equations before evaluating them. However, the |n modifiers tell the plugin you want to use the field’s name.

    The |v modifier can be used in the equations with the names of the Radio Buttons, Checkbox, and Dropdown fields. The Radio Buttons, Checkbox, and Dropdown fields allow you to configure the value to submit between the texts of ticked choices or their values. The |v modifier tells the plugin you want to use the value to submit to the server (this would allow you access to the choices texts from the equations).

    If you want to store the encodedTransport as a global variable, you only need to remove the var reserved word and assign the value directly.

    Edit the line of code var encodedTransport = encodeURIComponent(transport);

    As encodedTransport = encodeURIComponent(transport);

    Best regards.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.