Query submitted data

Learn how to query for Adaptive Form data in Azure Blob Storage using AEM Forms’ metadata service.

Hi. In this video, we will take a look at using the metadata key value properties on the Azure portal storage. So here, we have our form data model and the entity credit applications. And that entity has these various properties. And as you can see, each of these properties, some of these properties have this ribbon icon to indicate that this is a metadata key here. So, and to specify a metadata key for a property, all you need to do is to select the property name and click on this edit properties. And select this option, to indicate that it’s going to be a metadata key. So by the way, the metadata key can only be associated for primary data types. So for example, if you wanted to associate a metadata key for the applicant picture, which is of type boolean, which is of type binary, you will not be able to create a metadata key for that particular property. So then click on done. So, so these are my metadata. These are the properties which have metadata keys associated. Applicant name, city, address, state, zip code, and monthly income. And then you save your form data model.
And now if you submit your adaptive form to store the data in the Azure portal storage, the appropriate metadata key and value pairs will be generated and stored in the Azure portal. So let’s take a look at how it looks like in the Azure portal storage. So this is my container here, and these are the various form submission. So if I were to open one of these form submissions here, and click on the, this is the Blob ID here, by the way, which is social security number. And if I were to go down here, I would see the appropriate metadata key and value pairs that are generated here. So for example, the applicant income is the key, and the value 8,000 dollars. And the city is Albany. So this way, it’s quite easy to create the metadata key and value. And in the next video, we will use this metadata properties to perform a search on the form submissions.
Now that we have created metadata keys against the form data model object properties, such as applicant name, city, the next thing we need to do is to create, or configure a service which will allow us to query the submitted data using this metadata keys. So to do that, I have clicked on the service option here, and select this get metadata for Blobs from Azure, and click on add selected. Once you added the service, the next thing we need to do is to configure the service with the appropriate arguments. So select this service here, and click on edit properties. So the object model, output object model is going to be credit applications, because that is our model. And make sure you select return array, because most of the time, you will get multiple sets of data or multiple rules, depending on the query that you have configured. And the arguments that we need to specify are going to be the container name, because that is always going to be there, against in which container do you want this particular query to be executed. So that’s the container name. And the second argument you want is to use one of the model objects properties. So for example, I want to query on the applicant state, and that’s the title here, and click on add here. So this way, you can add as many arguments to your service as possible. At the minimum, you would need the container name. And then you would want to filter further, you can add that property. So in my case, I added the state. So what we are saying is, against a particular container name, get me all the applications submitted where the state is equal to, say, California. So then you do done to save, and then save. So let’s test this service from this form model editor UI here. Click on test service. So as you can see, there are two arguments here. The container name. We need to specify the container name. So this is always going to be credit application submitted. And the applicant state is going to be, say, California. Then click on test here. So it returns you, maybe three applications where the applicant was residing in the state of California. Okay? So now that our service is configured, the next thing we need to do is to use this service in an adaptive form, where the user should be able to specify the state against which to perform the search, and display the results in a tabular format in the adaptive form. So to do that, I have created a very simple adaptive form here, which has a dropdown list called the state of residence. And then it has a table with three columns, name, address, city. And one row with the three columns here. So applicant, name, address and city. So to invoke the service when the user has selected the appropriate state of residency here, we need to configure or create a rule here. So for that, I have selected the dropdown list, and click on this option to edit the rules. And I’ve already created a rule which gets executed when the user selects the appropriate state here.
So when the applicant state is changed, I’m going to invoke the get metadata for Blobs from Azure service. That’s our service. You can select this dropdown list to select the appropriate service. And the input for that service, like we saw, is the container name and the state. And the state is coming from the value of the dropdown list here. So you can simply drag and drop this here. And the output is going to return multiple. It’s going to return a lot of properties here. It’s up to you which properties you want to display in your table. So for example, in my case, I’ve just selected applicant name, city and the address. And I simply dragged and dropped this applicant name from here, and, and placed it on this applicant name in the output column here. So this way, you can configure as many columns as you want to display. So now that our form is configured, we’ll, let’s close this. And there’s one more thing that I wanted to show. Make sure you select the row 1. Let me refresh. Since our query can return multiple rows of data, and you want to display that in the table, make sure you select the row 1 in which you’re going to display. And that row 1 is configured to have a minimum count of one, and the maximum count of hundred. This number can be any number based on your preferences. In my case, I’ve set to limit the table to hundred rows. But you can change this number according to your preferences. And then if I were to do a preview of this particular form here, I’ll do a preview of this form in HTML.
And the state of residence, if I select California, I should get back three rows with the name, address and city. So this way, it is quite easy to submit data to forms, Azure portal storage. And retrieve the same data using the use of metadata tags, which we provide out to the box. -