If you like to refer to the value of a variable of type Object available in an action, you can access the element with a selector or square brackets connected to the variable with a dot.
As an example of an Object type variable, if you use IVAR’s face recognition feature and execute an action in the Trigger Manager, you will receive the following JSON data in your action. (Partial Data)
This data can also be referenced by any component as tv.Data
(TriggerVariable.Data) when the action is executed. It can also be referenced as cv.Payload
in the first component, as it is also the Payload of the first component.
{
"id":"XXXXXX",
"source":{
"channel":4,
"bacId" : "YYYYYY",
"taskId" : "ZZZZZZ",
"ivarId" : "000000"
},
"common":{
"description":"Face Recognition",
"presentImageTime":"2019-06-17T07:53:22.986Z",
"time":"2019-06-17T07:53:22.986Z",
"type":"FR"
},
"iod":{
"age":"MIDDLE",
"ageRange":[
38,
53
],
"faceAvailable":true,
"frSuitable":"NA",
"gender":"MALE",
"glasses":"REGULAR",
"groupId":0,
"liveness":"NO_RESULT",
"livenessProbability":"0.0000",
"mask":"NA",
"objectId":649,
"objectType":"FACE",
"occlusion":"NA",
"race":"NA"
},
"fr":{
"candidates":[
{
"customId":"00001",
"displayName":"Person B",
"id":"6",
"indentityGroup":"Company A",
"similiarityScore":"0.7272"
}
],
"fdrVersion":"60032084",
"indentityGroup":"Set2",
"mmsReturn":"OK"
}
}
For example if you are referring to: fr -> candidates -> displayName
tv.Data.fr.candidates[0].displayName
It is written as
IVAR JSON is a simple key name, so you can refer to it using the dot-connected selector, but if a space or hyphen is used in the key name, you can also refer to it as follows (if the display name contains a space). fr and candidates can be mixed and matched by connecting them with dots.
tv.Data["fr"]["candidates"][0]["display Name"]
tv.Data.fr.candidates[0]["display Name"]
The above is only for referencing and retrieving values, but it can be used in the same way to insert conditional expressions in Filter components.
cv.Payload.fr.candidates[0].displayName == "Person B"
These features can be used in addition to actions, where you can write trigger conditions and expressions.
You can also enter an expression in the IVAR condition of a trigger, and if you want to trigger an action only for men, you would write the following expression
tv.Data.iod.gender == "MALE"
Need more help with this?
Join our slack community for help