Page 1 of 1

Variable to Variable action lowercases the variable

PostPosted: Wed Dec 27, 2023 3:36 am
by pnm
I have a schedule to store the contents of one variable in another then reset the first one back to zero.

If I use a Set Variable to Variable action the variables get lowercased and therefore don't work e.g. HeatingMinutes becomes heatingminutes

If I use the Modify Variable action this doesn't happen and it remains mixed case.

The actions list looks like this:
set value of 'previousactivetotal' to the value of 'activetotal'
set variable ActiveTotal to 0

How do I stop it doing this (apart from using lowercase variables)?

Re: Variable to Variable action lowercases the variable

PostPosted: Wed Dec 27, 2023 9:46 am
by DaveL17
I'm not seeing the same behavior. What version of Indigo are you using?

I created two variables: xxx1 and xxx2.
I set the value of xxx1 to "True"
I `Set the Value` of xxx2 to the value of xxx1.
I `Modify` the value of xxx1 to 0 (I added a one second delay on this one.)

xxx1 = "0"
xxx2 = "True"

Re: Variable to Variable action lowercases the variable

PostPosted: Wed Dec 27, 2023 10:09 am
by jay (support)
That is just a UI thing: the summary shows lower case in the Mac client action list, but it doesn't change the behavior because the action (in code) uses the id of the variables, not the names. You should probably look more closely at your schedule to make sure that it's configured correctly.

Re: Variable to Variable action lowercases the variable

PostPosted: Wed Dec 27, 2023 10:11 am
by ryanbuckner
I also tried this and it was successful. Also added a delay between the 1st and 2nd command.

Variables:
I created two variables: previousactivetotal and activeTotal.
I set the value of activeTotal to "35"

Created an action group to test:
Step 1 - I `Set the Value` of previousactivetotal and activeTotal.
Step 2 - I `Modify` the value of activeTotal to 0 (I added a 3 second delay on this one.)

Results:
activeTotal = "0"
previousactivetotal = "35"

Re: Variable to Variable action lowercases the variable

PostPosted: Wed Dec 27, 2023 4:23 pm
by pnm
You are using lowercase though, if the variables are called ActiveTotal and PreviousActiveTotal, what happens?

Re: Variable to Variable action lowercases the variable

PostPosted: Wed Dec 27, 2023 4:32 pm
by ryanbuckner
my variable name is activeTotal. I changed the other to "PreviousActiveTotal" and there was no problem.

As Jay noted, the ID of the variable is what is used anyway.

What version of Indigo are you using ?

Re: Variable to Variable action lowercases the variable

PostPosted: Wed Dec 27, 2023 5:11 pm
by DaveL17
pnm wrote:
You are using lowercase though, if the variables are called ActiveTotal and PreviousActiveTotal, what happens?

I redid the example with your variable names and Indigo did not change them. The only thing that I can think of that might be different between our setups is localization settings; but I can't think of a reason that would matter.

Re: Variable to Variable action lowercases the variable

PostPosted: Thu Dec 28, 2023 1:53 am
by pnm
I'm using 2023.1 on a new Mac mini in the UK, but I had the same issue with 2022. If I execute the schedule both variables end up at zero.

Edit
It's the Delay that fixes it. If I add it to the reset to zero step it works, do the steps run in parallel?

Re: Variable to Variable action lowercases the variable

PostPosted: Thu Dec 28, 2023 5:31 am
by DaveL17
Indigo actions are asynchronous -- meaning that any individual task can complete at any time. This is by design and is a great feature of Indigo. If it weren't that way, a hung script or non-responsive device could hold up the entire show. A delay is a way to mimic synchronous commands, but it's still not assured that one will complete before another. If you must have one command run before another starts, the best way is some form of conditional, like: "When the value of variable 'PreviousActiveTotal' changes, set the value of variable 'ActiveTotal' to 0".

I am completely stumped on why any variable name would change from upper to lower case.

Re: Variable to Variable action lowercases the variable

PostPosted: Thu Dec 28, 2023 10:43 am
by jay (support)
DaveL17 wrote:
I am completely stumped on why any variable name would change from upper to lower case.


It is only changed when the description of the action is displayed in the Mac Client UI. For historical purposes, we've always lowercased the descriptions when we show them in the action list (probably not the right choice for this particular usecase). It does not, however, impact the operation of the action since it's just a UI display choice.

Re: Variable to Variable action lowercases the variable

PostPosted: Thu Dec 28, 2023 11:14 am
by ryanbuckner
pnm wrote:
I'm using 2023.1 on a new Mac mini in the UK, but I had the same issue with 2022. If I execute the schedule both variables end up at zero.

Edit
It's the Delay that fixes it. If I add it to the reset to zero step it works, do the steps run in parallel?


Can you please post a before and after screenshot of where you are seeing your variable name being changed? It also sounds like your process is running properly now?

Re: Variable to Variable action lowercases the variable

PostPosted: Thu Dec 28, 2023 11:27 am
by DaveL17
jay (support) wrote:
It is only changed when the description of the action is displayed in the Mac Client UI.

Sigh. It didn't occur to me that we could be talking about the Actions list.

Re: Variable to Variable action lowercases the variable

PostPosted: Thu Dec 28, 2023 6:21 pm
by ryanbuckner
DaveL17 wrote:
jay (support) wrote:
It is only changed when the description of the action is displayed in the Mac Client UI.

Sigh. It didn't occur to me that we could be talking about the Actions list.


This is why I asked for a screenshot. It was unclear what the actual problem was