Cannot access values after assignment[Resolved]

variables

#1

1) Give a description of the problem
After setting a global variable using $response I can no longer access the child variables.

2) What is the expected behavior?
Continue to access the child variables in the collection as I did in the $response variable.

3) What is happening/not happening?
Cannot access the children in the collection.

**4) Post a Green Snapshot of the piston

**5) Attach any logs!

I’m new to webCoRE and home automation but have had some experience with programming (I still remember assembly language - vaguely).

I’m sure this is very easy and I am missing it. However, I’ve spent days trying to figure it out and finally decided I needed help.

Any thoughts would be appreciated.


#2

A global variable is not written until after the piston completes the last line of code.
Try pulling that data from another piston after it has been set. (untested)


#3

The expression editor showed an error when you were typing the expression in the last log line. The value.property[index] syntax is only supported on certain system variables like $json, $response, and $twcweather. Once assigned to a local variable you can no longer use that syntax. The only option is to store individual properties to variables.


#4

It is a shame we cannot store 50 data points into one global variable…
I can imagine so many possibilities with this!!


#5

Well, that certainly explains it. I come from a Visual Basic background where we could sling collection classes around like hash on a griddle.

Thanks, so much. I can now go back and work on those other five projects that got stopped because of this.

I knew all along it was an operator headspace and timing error.