Varsuuk
March 11th, 2019, 08:40
[SOLVED]
Going to head to sleep, this may be a dumb question that will become clearer with a night's sleep but here goes:
Other than by fully qualifying from getDatabasenode() sort of level, is there a way to access a sibling's numeric data? ie, the value that would be returned with getValue() if we were in that control at the time?
l
If I have 3 number controls in a sheet data section and I wish to make controlC value = controlA value + controlB value, what is the way I would do this in the <script>onInit()</script> section for controlC?
controlA's source is foo.a
controlB's source is foo.b
controlC's source is foo.c
in controlC's script section...
l
<script>
function onInit()
setValue(DB.getValue("..", "a", 0) + DB.getValue("..", "b", 0));
end
</script>
The console reports: "attempt to perform arithmetic on string value"
All three controls derive from "basic number".
I know it isn't an adding of string + number thing - if I just got database node and did get value off that node with "foo.a" as a param added to another get of db node with "foo.b" as the param - the numbers would add up.
So I am looking for basically the right way to inside the script of a control retrieve the values of sibling (or more generally other nodes using relative pathing)
It is killing me as I reread this that the answer will be obvious once someone explains it... ;) but it is nearly 4am for me so... go figure ;)
Going to head to sleep, this may be a dumb question that will become clearer with a night's sleep but here goes:
Other than by fully qualifying from getDatabasenode() sort of level, is there a way to access a sibling's numeric data? ie, the value that would be returned with getValue() if we were in that control at the time?
l
If I have 3 number controls in a sheet data section and I wish to make controlC value = controlA value + controlB value, what is the way I would do this in the <script>onInit()</script> section for controlC?
controlA's source is foo.a
controlB's source is foo.b
controlC's source is foo.c
in controlC's script section...
l
<script>
function onInit()
setValue(DB.getValue("..", "a", 0) + DB.getValue("..", "b", 0));
end
</script>
The console reports: "attempt to perform arithmetic on string value"
All three controls derive from "basic number".
I know it isn't an adding of string + number thing - if I just got database node and did get value off that node with "foo.a" as a param added to another get of db node with "foo.b" as the param - the numbers would add up.
So I am looking for basically the right way to inside the script of a control retrieve the values of sibling (or more generally other nodes using relative pathing)
It is killing me as I reread this that the answer will be obvious once someone explains it... ;) but it is nearly 4am for me so... go figure ;)