Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
how can I get the value of a single variable and use it in Javascript?
I need to get the current selection of a field from a variable and use this value as a string in order to do a if/else comparison.
Example:
varQV = Only(Field)
In JS I then want to do: if (varQV ="string of varQV") ....
I tried with the mydoc.GetAllVariables function but I can't get the string of the field only the definition [Only(Field)]
Hope you can help.
Thank you,
Thorsten
Unfortunately it is not possible to get the evaluation of a variable using the GetAllVariables function, only the definition is available in the returned object.
However you can get the evaluation of the variable by using it in a Text expression of your extension property. In your definition.xml file, add :
<Text Expression="=varQV" />
You will then be able to get the variable value in your javascript code with the following code in your extension method:
var varQV = this.Layout.Text0.text;
Unfortunately it is not possible to get the evaluation of a variable using the GetAllVariables function, only the definition is available in the returned object.
However you can get the evaluation of the variable by using it in a Text expression of your extension property. In your definition.xml file, add :
<Text Expression="=varQV" />
You will then be able to get the variable value in your javascript code with the following code in your extension method:
var varQV = this.Layout.Text0.text;
Hello jgeorge, it does not work for me.
I do as they write everywhere. But nothing happens.
QV 12 November release.
Could you throw off the finished two files (.xml and .js)so that I can understand the error?