Obtain the API Call
The first thing you need to do is get the API call you want to use in Amplus Forms, to do this go to the API Explorer.
These are the parameters that we need to take into account in this call
Name | Description | Required | Notes |
CompanyId | Your unique company identifier | Yes | |
IntegrationKey | Your unique integration key | Yes | |
FormExternalId | External ID of the Form to fetch entries for | No | If you want to have all versions, it must be provided instead of the Form ID |
Form ID | Identifier of the specific Form Screen to fetch entries for | Yes | |
FormVersion |
Version of the Form that you wish to fetch entries for. If not specified or zero (0), will return entries for the latest Published version. Use version of -1 to return entries across all versions of the Form | No | |
AnswerFormat |
Whether or not to return rich answers or raw answers | Yes | This is required and we must select the "Flat" option. Because with that option we can put in the "Fields" parameter the specific fields that we are looking for |
MediaAsUrl | Returns Media answers as full file download URLs instead of just the file name | No | Si queremos mostrar imágenes esto debe estar en la opción "Verdadero" |
Fields | Optionally restrict returned answer values to the given comma-separated list of field data names. | ONLY SUPPORTED WITH 'FLAT' ANSWERFORMAT. |
If you fill all the required fields, you can get a response like this:
Create the Form
To use the call that we obtain in the before step ,we need to create a form this form need to have the following fields:
Dataname | Field Type | Note |
Query | Text Field | Text field for the user to put the query to find a specific form entry. |
API_Call | REST Field | A REST field that allows us to make the call to get the Form Entries. Here we put the URL obtained in the previous step. |
Concat2 | Hidden Field | It is a hidden field to add the double quotes to the query with the CONCAT function. For example CONCAT("'", {{query}}, "'") |
Concat2 | Hidden Field | It is a hidden field in which we add the content that we will use in a JSONVAL function later.CONCAT('Entries[?(@.AnswersFlat[0].testField ==', {{concat}}, ')].AnswersFlat[0].photo') This is an example of a JSONVAL body, this return the photo field when the 'testField' is equal to our query. |
Result | Text Field | We need to add one last field, where the response will be displayed and stored, in this field we will apply the JSONVAL with the API Call and Concat2 fields.JSONVAL({{ApiCall}}, {{concat2}}) |
Result Image | Text Field | If want to show an image we need to add a Media field and add in dynamic value the following code: SUBSTR(JSONVAL({{APICall}}, {{concat2}}), 0, INDEXOF(JSONVAL({{APICall}}, {{concat2}}), '|')) That give us the specific URL to can provide it to the Media Field |
Following all these steps we can see the field we are looking for