Extracting a text and number using remote lookup
You can use a remote lookup field to extract data from an external API. For example, you may want to display the general weather forecast and temperature for a particular city.
- Create a new text field called City.
- Create a remote lookup field called Weather.
- In the URL field, add the API link such as one from OpenWeather.
- In this link, we’ve entered the Field ID from the first field we made.
- Choose GET as the request type.
- Header name and Body name are not required for this example.
- In the field What kind of data are you working with?, choose JSON
- In JSON path of value in result enter
$
- In the field What kind of data are you working with?, choose Text.
- In the field How should the result be chosen?, choose Autopopulate a value and click Done.
- To extract the forecast as text, create a new text field called Forecast. Enter the formula as
Weather.extractText("$.weather[*].main").get(1).
- To extract the temperature as a number, create a new number field called Temperature. Enter the formula as
Weather.extractNumber("$.main.temp", 1)
When extracting any data from a JSON, use this pattern:
Remotelookup_Fieldname.extractNumber(path, index)
Remotelookup_Fieldname.extractText(path, index)
We have deprecated the expression Remotelookup_Fieldname.extractJson(path, index)
. However, we will continue supporting the fields which already have this expression. You will not be allowed to use this expression in a new field.
In the live form, when you type the city and click Get Data. The temperature and forecast will be displayed.