Action Syntax examples
Overview
This document provides examples of the Action Syntax used to define actions in Form Builder.
Example 1: List of Nobel Prize winners
The Nobel Prize organization exposes a REST API. We would like to create a form that queries that API to return the 2023 Nobel Prize winners, and show these details in a table.
To do this, we start by creating a simple form with a nested repetition:
a repeated section for the Nobel Prizes
a nested repeated grid for the laureates
Here is how the form looks like in Form Builder:

We then also create an HTTP Service endpoint:

It points to the following API endpoint:
This returns data in JSON format (with ... to indicate omitted parts):
Form Runner operates on an XML view of JSON data so that you can use XPath formulas. You can see it directly in the "XML Response Body" of the HTTP Service Editor. Here is what that view looks like:
Finally, we write, using the Form Builder's Action Syntax, an action that:
runs upon form load
calls the
get-nobel-prizesserviceclears the
prizesrepeatiterates over the Nobel Prizes (
/*/nobelPrizes/_), and for each entryadds iterations to the
prizesrepeatsets values in the controls
yearandcategoryfrom theawardYearandcategory/enfields in the dataclears the
laureatesrepeatiterates over the laureates (
laureates/_), and for each entryadds iterations to the
laureatesrepeatsets values in the controls
known-nameandmotivationfrom theknownNameandmotivation/enfields in the data
There is a nested iteration due to the nested repeats. here is what the complete listener and action look like:
When you test or run the deployed form, you see the Nobel Prize winners for 2023:

See also
Blog post: Making sense of Form Runner Actions
Last updated