Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone...
i have this little question...probably i wrong something...
-i set in my sheet a variable in this way :
var1=GetFieldSelections(dbName)
-when i select a value in an object, in the sheet this variable is set to the value that i select , but
when i try to use this variable in the load script i found this with the value of the formula and not with the right value .
EX:
if i select in my object a field with value of "mydb" in the sheet the variable have value = mydb but in the script the value of the var is "GetFieldSelections(dbName)"
Why ? what's wrong?
I have to use macro to convert into another variable the text value of my var1 and use the new var in the script!!!!
thank everyone and sorry for my english.
Wava
yes !! But you just don't understand how yet. See attached qvw. Change the selection, reload and check the values of the variables. var3 is set with a trigger, varX is set in the script.
You probably didn't define the variable correctly or need to use the right $-expansion. See here for the different ways variables can be defined and used.
No i think that i define the variable correctly in the sheet:
var1=GetFieldSelections(dbName)
and use the $var1 to read the value in my script , but i found the formula and not the value .
If in my sheet i set the variable this a costant value :
var1='my value'
and use the $var1 to read the value in my script it's work fine!!!
Why with the constant work , but not with the formula?
Ah, I see what you're trying to do, ie using chart functions in the script. GetFieldSelections cannot be used in the script. Selections aren't available in the script. You could store them in a variable first I think, but you can't use chart functions in the script afaik.
I understand , but i don't find a function to save the value of my var in an other var .
If i set var2=var1 in my sheet , in the script i have the same problem , the value of var2 in the script is "=var1".
EX:
if var1=GetFieldSelections(myfield) and myfield value is "Qlik" and i want in var2 the constant "qlik"
The only way to do this that i found is use macro but it sound a little crazy.
does not exist another way?
Thank
Wava
Yes, you can use a trigger to set a variable with an action. If you set the value of the variable to =getfieldselections(myfield) then the variable will get as value a comma separated list of values instead of the unevaluated expression. Then you can use that variable in the script. LET varY = '$(varX)';
no !!
KO
using LET varY = '$(varX)'; in the script i have the formula not the value.
thank
wava
yes !! But you just don't understand how yet. See attached qvw. Change the selection, reload and check the values of the variables. var3 is set with a trigger, varX is set in the script.
You are great!!
The way is however strange , because from variable definition i can't do it and with trigger i can !!!
This way is better than use a macro to do this.
Thank a lot for your answer
Bye
Wava