Copy Variable Value into 2nd variable

Posted on
Sun Nov 29, 2020 1:27 pm
jltnol offline
Posts: 989
Joined: Oct 15, 2013

Copy Variable Value into 2nd variable

So I'm trying to copy the value of one variable into a 2nd variable. I've tried a number of things but can't this to work. I'm guessing that I'm not actually pulling the value for theVar1 here to actually put into the 2nd one, but not sure how to do this. I'm also guessing I can bypass all this with one line of code that would copy the value from one into the 2nd one, but... am stuck... :(


Code: Select all

OldInches = indigo.variables[1271637680] #Old Inches
theVar1 = indigo.variables[1852577407] #Today rain in inches
indigo.variable.updateValue(1271637680, theVar1) #inserts today rain into old inches

Posted on
Sun Nov 29, 2020 3:01 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: Copy Variable Value into 2nd variable

You need .value at the end to get the value
Otherwise you have the variable object
Check out the examples


Sent from my iPhone using Tapatalk

Posted on
Sun Nov 29, 2020 7:16 pm
jltnol offline
Posts: 989
Joined: Oct 15, 2013

Re: Copy Variable Value into 2nd variable

That did it.
Thanks

Code: Select all
OldInches = indigo.variables[1271637680] #Old Inches
theVar1 = indigo.variables[1852577407] #Today rain in inches
indigo.variable.updateValue(1271637680, theVar1.value) #inserts today rain into old inches

Posted on
Sun Nov 29, 2020 9:11 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: Copy Variable Value into 2nd variable

You don’t need the first line.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 8 guests