Script Execution Example Page 2

After the last page, our stack and code looked like this…

StackCode
TE101 [Constant]ASSET [Command]

Now, it's time to copy the next line from code to the stack.

However, this time it's a command - rather than these being copied directly onto the stack, it's executed instead.

A command will almost always 'eat' one or more parameters off the stack. In this case, the ASSET command will eat a single item from the stack - the name of the asset it needs to search for.

StackCode
Running: ASSET ( TE101 )

A command may optionally add items to the stack as well. In this case, it will leave an Asset List on the stack, containing a single asset with the best matching name.

StackCode
AssetList [ { id: 203, name: “Temperature Sensor #1”, ern: “TE101” } ]

And now our script has reached its end. As a result, we have the name, ern and ARDI ID of the asset Temperature Sensor #1, which has ERN number TE101.


The key to the system though is how you can chain commands together to create complex results. What if we wanted to know the value of a particular property for this asset? Or find out which properties were available for it?

In page 3, we will see how we can keep the stack going to ask more interesting questions.