ArrayItem Evaulation


#1

1) Give a description of the problem
I’m not getting the expected value from the arrayitem invocation.

2) What is the expected behavior?
I expected the arrayItem(AppleState, AppleTemps) to provide a minimum temp.

3) What is happening/not happening?
I’m getting a 0 result.

**4) Post a Green Snapshot of the piston

5) Attach any logs (From ST IDE and by turning logging level to Full)

|+4ms|╔Received event [Home].test = 1522345697978 with a delay of 4ms|
|---|---|
|+134ms|║RunTime Analysis CS > 17ms > PS > 57ms > PE > 57ms > CE|
|+140ms|║Runtime (50785 bytes) successfully initialized in 57ms (v0.3.104.20180323) (135ms)|
|+144ms|║╔Execution stage started|
|+154ms|║║Cancelling statement #1's schedules...|
|+173ms|║║Error executing virtual command [Nest Weather (83642)].setVariable: (11ms) groovy.lang.MissingPropertyException: No such property: result for class: script_app_webCoRE_Pi_896af5e1_97fc_4551_a22d_34ddaa5e0426_ver_0_1 Possible solutions: request|
|+178ms|║║Error executing virtual command [Nest Weather (83642)].setVariable: (1ms) groovy.lang.MissingPropertyException: No such property: result for class: script_app_webCoRE_Pi_896af5e1_97fc_4551_a22d_34ddaa5e0426_ver_0_1 Possible solutions: request|
|+183ms|║║Error executing virtual command [Nest Weather (83642)].setVariable: (1ms) groovy.lang.MissingPropertyException: No such property: result for class: script_app_webCoRE_Pi_896af5e1_97fc_4551_a22d_34ddaa5e0426_ver_0_1 Possible solutions: request|
|+188ms|║║Error executing virtual command [Nest Weather (83642)].setVariable: (1ms) groovy.lang.MissingPropertyException: No such property: result for class: script_app_webCoRE_Pi_896af5e1_97fc_4551_a22d_34ddaa5e0426_ver_0_1 Possible solutions: request|
|+193ms|║║Error executing virtual command [Nest Weather (83642)].setVariable: (1ms) groovy.lang.MissingPropertyException: No such property: result for class: script_app_webCoRE_Pi_896af5e1_97fc_4551_a22d_34ddaa5e0426_ver_0_1 Possible solutions: request|
|+198ms|║║Cancelling statement #10's schedules...|
|+206ms|║║Executed virtual command [Nest Weather (83642)].setVariable (5ms)|
|+213ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+219ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+224ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+230ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+236ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+241ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+247ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+251ms|║║Cancelling statement #16's schedules...|
|+257ms|║║Executed virtual command [Nest Weather (83642)].setVariable (4ms)|
|+265ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+273ms|║║Executed virtual command [Nest Weather (83642)].setVariable (4ms)|
|+280ms|║║Executed virtual command [Nest Weather (83642)].setVariable (4ms)|
|+286ms|║║Executed virtual command [Nest Weather (83642)].setVariable (4ms)|
|+292ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+299ms|║║Executed virtual command [Nest Weather (83642)].setVariable (4ms)|
|+305ms|║║Executed virtual command [Nest Weather (83642)].setVariable (4ms)|
|+308ms|║║Cancelling statement #25's schedules...|
|+314ms|║║Executed virtual command [Nest Weather (83642)].setVariable (4ms)|
|+320ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+326ms|║║Executed virtual command [Nest Weather (83642)].setVariable (4ms)|
|+332ms|║║Executed virtual command [Nest Weather (83642)].setVariable (4ms)|
|+337ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+343ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+349ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+351ms|║║Cancelling statement #33's schedules...|
|+357ms|║║Executed virtual command [Nest Weather (83642)].setVariable (2ms)|
|+362ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+367ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+373ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+379ms|║║Executed virtual command [Nest Weather (83642)].setVariable (4ms)|
|+538ms|║║Executed virtual command [Nest Weather (83642)].setVariable (4ms)|
|+544ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+547ms|║║Cancelling statement #41's schedules...|
|+554ms|║║Executed virtual command [Nest Weather (83642)].setVariable (4ms)|
|+560ms|║║Executed virtual command [Nest Weather (83642)].setVariable (4ms)|
|+566ms|║║Executed virtual command [Nest Weather (83642)].setVariable (4ms)|
|+571ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+577ms|║║Executed virtual command [Nest Weather (83642)].setVariable (4ms)|
|+582ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+588ms|║║Executed virtual command [Nest Weather (83642)].setVariable (3ms)|
|+590ms|║║Cancelling statement #53's schedules...|
|+603ms|║║Executed virtual command [Nest Weather (83642)].setVariable (2ms)|
|+611ms|║║Comparison (decimal) 54.0 is_less_than (integer) 0 = false (2ms)|
|+612ms|║║Condition #50 evaluated false (7ms)|
|+613ms|║║Condition group #49 evaluated false (state did not change) (8ms)|
|+616ms|║╚Execution stage complete. (475ms)|
|+621ms|╚Event processed successfully (621ms)|

#2

Can you post a manual screen snip showing appleTemps populated with its data?

Maybe instead of appleTemps being a list variable, make it a regular integer and enter the values fixed in comma separated format.

define
integer appleTemps = 15,18,23,27,etc


#3


#4

Changing the data type from list to string got it working with arrayItem. Thanks for the tip.


#5

If you did need to use lists, it looks like you could just do AppleTemps[AppleState] which is entered by selecting Variable, then AppleTemps, then type AppleState in the index field which should automatically detect that as a variable. arrayItem is an older function that operates on comma-separated strings rather than actual list variables.


#6

OK, my NOOB status shows here. I am trying to take action if TimePassed is any of 60, 120, 180, 240 minutes. So instead of doing multiple nested IF statements, I thought I could do something with an array…like

If TimePassed is in {60, 120, 180, 240}
Then…

Do I define an integer array TimeArray = 60, 120, 180, 240 ?