Use Variable within QueryList function in RichForms
AnsweredHi Everyone,
i want to use the following expression function : [[@Web.GetFirstValueForQuery('Customers', '<Query><Where><Eq><FieldRef Name="ID" /><Value Type="Text">2</Value></Eq></Where></Query>','Title')]];
with a variable.
Like this:
var varP=2;
[[@Web.GetFirstValueForQuery('Customers', '<Query><Where><Eq><FieldRef Name="ID" /><Value Type="Text">”+varP+”</Value></Eq></Where></Query>','Title')]];
But if I use it like this I get a reference error that the variable “varP” is not defined.
How can I achieve this that it works ?
-
Hi Atilla Özer,
you can use expression placeholders as well in functions e.g. using a window variable like this:
window.varP=2;
return [[@Web.GetFirstValueForQuery('contacts7', '<Query><Where><Eq><FieldRef Name=ID /><Value Type=Number>[[=window.varP]]</Value></Eq></Where></Query>','Title')]];
BR Matthias
0
Please sign in to leave a comment.
Comments
1 comment