Access Operator
Access Operator, or Property Access Operator
to be more specific, is to retrieve the value of a property of an object. For example, if we have an object user
with a property name
, in text-based programming language like Javascript, we can access the value of name
by using the .
operator:
let user = {
name: 'Mark',
phone: '110'
}
user.name
How can we do that in a visual programming language? We can use the .
node to achieve the same goal.
Add Node
Right-Click Anywhere on canvas, select Operator/Access
Access Dictionary
A dictionary is like a map, it has keys and for each key, there is one corresponding value, we can access the value of a key by using the .
operator. So create a dictionary and input some test data, then use the .
operator to access the value of a key.
Compare
The example above shows that text-based programming language takes fewer spaces. This is a major con for visual programming lanuage.
Access Property of an Object Variable
If the data type of the variable is an object, we can use the .
operator to access the property of the object.
Note at the top left corner of .
node, we show the object's name. This becomes helpful when two nodes are far apart.
Access JSON results from Http response
If the data of an http response is a JSON, we can use the .
operator to access the property of the JSON.
Chained Access
We can always chain .
operator, provided the previous step returns an Object.