Adding JavaScript field allows you to create a small piece of code that uses fields as variables and compute the result based on this data. It will help to generate the fields make it easier for the end user to add data to the Library.

To add the JavaScript, click Mobile: Add button icon, go to Field and choose the relevant option from the list of field types. Type the field name and write the script:

Tap Field to add variables: other fields added to this Library. Write the lines of code in Script panel. From the toolbar on the right from Field option, you can Run the script using the data of any chosen entry to test it or get Help.

On the screenshot above, there is a small script that computes the Importance of the Purchase based on the Category of the purchased product. It is as easy as:

if (field(“Category”) == “Food”) ‘Yes’; else ‘No’;

The detailed information and several useful examples can be found on the wiki.

Was this article helpful?

Related Articles