Please enable JavaScript to view this site.

Codolex

Previous topic: Adding a datasource

 

Codolex has now created a new entity with the structure based on the JSON result. Using entities makes it very easy to work with data in a structured way. Let us now modify the example application so that the result of the REST Operation is loaded into a new entity of the TimeZoneResult type.

 

First, go back to the GetTimeZone flow, and delete the ShowDialog activity. The REST Operation will return the JSONResult variable that we’ll use to convert this variable to an entity. To do so, drag and drop a JSON to Entity activity in the flow, after the REST Operation, and double click on the JSON to Entity activity.

 

To convert the JSON string to an actual entity, click on the three dots next to the entity input, and select the TimeZoneResult entity. This is the structure we are going to import our JSON in. Next, select the JSONResult variable. This should be the only one available. You can keep the name of the result (TimeZoneResult) and click save.

 

Now, let’s now change the flow to a function instead of a procedure so that we can give back the newly created entity. For this, right click on the JSON to Entity activity, and click on the option “Set variable TimeZoneResult as return value for flow”.

 

clip0015

 

You will see now that flow's endpoint displays the flow's result, which, in our case is an entity. To use this entity in code, let’s change the OnClick code so we store the result of the flow. As an example, we can display one of the fields of our entity:

clip0016

 

By default, all fields in a Codolex entity are nullable. There are several functions available to work with these nullable fields, which will be explained in more detail here.

 

This concludes the basic explanation of creating a Codolex application. In the next sections we will dive into the details of a Codolex project.

© by GDK Software