Within the Process, under the Nodes tab, select from the menus +Add -> Input Object, as shown below.
In the dialogue which appears, you give a name for the input and also select its type.
The name can be anything (lower-case, no spaces, and not clashing with any other value names in the Process). It is essentially a variable which will allow us to refer to the instance within the Process. Typically, we simply use the name of the Object (type).
After you click Ok, then you will see the Input Object at the top of the Process, which does not yet contain any nodes at all.
Using values from an Input Object within a Process
We have configured an input object in the Process. How can we use it?
Well, one thing we can do is to access the values of the fields of the Object (instance).
To give a simple example, suppose we would like the first screen which the health workers sees when choosing to do a visit for a patient, is a confirmation of the patient's name.
You can use the values of variables in Logiak by surrounding them with question marks.
When you have an Object (instance), you can use the values of its fields by appending the field name to the name you introduced for the instance itself.
So, ?patient.name? is a way of using the value of the "name" field of whatever object instance we are referring to with "patient".
So let us add a simple display screen to show the message we want.
Within the Process, select to add a display screen by navigating the menus as show here:
Then, we can set use the patient's name within the text of the display like this:
When your App develops and your objects get bigger, it might be handy to know you can automatically insert the expression you want by selecting from the "Insert at Cursor" menu as shown here:
Updating an Object
Another typical thing we want to do is to update an Object (instance):
Suppose the user checks at every visit whether the patient is "allergic" (what this means exactly can be left unspecified for the purposes of demo).
If this true, we should update the TRUE/FALSE field "allergic" in the patient object accordingly.
Let us see how to do this.
Firstly, let us add a yes/no question about the patient and allergy.
Within the Process, navigate within the menus to add a Yes/No question as shown below:
Enter the question
Now we can add an action to update the instance of patient we are dealing with (the one which was input - the one the user had selected)..
Navigate in the menus as shown below to add an Update Object Instance Action:
In the dialogue which appears, you have to select which Object (instance) you want to update (in our example, there is only one in the Process so far), and provide a name for the action.
As with the Create Object action, immediately a dialogue appears which lets you map values from the Process into fields in the Object (instance) you are updating. These values will then overwrite whatever values were there before.
So, to summarise, we have seen
how to define a Process with an input Object
how to use current values of that Object
how to update that Object