Home › Forums › vLooup for SharePoint › Var CAML Broken?
Tagged: CAML-query var
- This topic has 13 replies, 2 voices, and was last updated 4 years, 8 months ago by Tricia S..
-
AuthorPosts
-
-
March 6, 2020 at 18:09 #28991
I have a var in the Write your own CAML-query section of the vLookup and its no longer working.
I testing replacing the the {var:finalCAML} with the Real CAML that my var is building and it worked fine.
It seems to be calling the function and Building everything correctly but its not using the result and it won’t even use the result if I do:
var finalCAML = “<Where><In><FieldRef Name=’ID’/><Values><Value Type=’Number’>2</Value><Value Type=’Number’>3</Value></Values></In></Where>”;Could the Write your own CAML-query section be broken?
-
March 6, 2020 at 19:05 #28993
Do you get an error message about an undefined variable, or does it just not work?
Also note that the variable defined in Custom JS only works for the forms and not if you use vLookup in a list view.
Alexander
-
March 6, 2020 at 19:10 #28995
The Var in the custom JS seems to be working fine, but the vLookup keeps pulling all when it should only pull the items listed in my var. See image.
Its like it Can’t tell that the CAML is there so it just pulls everything.
Attachments:
-
March 6, 2020 at 20:47 #28998
I can have its as simple as
Custom JS:
var testCAML = “<Where><In><FieldRef Name=’ID’/><Values><Value Type=’Integer’>1</Value><Value Type=’Integer’>4</Value></Values></In></Where>”;with
Write your own CAML-query:{var:testCAML}and it won’t work, It just pulls all Items.
But if i just do :
Write your own CAML-query:<Where><In><FieldRef Name=’ID’/><Values><Value Type=’Integer’>1</Value><Value Type=’Integer’>4</Value></Values></In></Where>It works fine. It just pulls the ID’s listed.
-
March 6, 2020 at 21:00 #29000
Ah, I think I know the reason. I made a check that looks for
in the Write your own CAML query – and if this is not present, it uses the Query builder instead – and this must run before your variable is processed. Try using it like this in your Build your own CAML:
<Where><In><FieldRef Name='ID'/><Values>{var:myCAML}</Values></In></Where>
And then add only this to your variable:
var myCAML = "<Value Type='Integer'>1</Value><Value Type='Integer'>4</Value>";
Alexander
-
March 6, 2020 at 21:08 #29002
Now I’m getting an error.
Attachments:
-
March 6, 2020 at 21:15 #29006
Try adding vLookupDebug=1 to your form URL like this:
What does the output show?Alexander
-
March 6, 2020 at 21:19 #29008
Now we are cooking. Its seems to be not formatting it right.
Attachments:
-
March 6, 2020 at 21:27 #29011
How are you constructing the variable?
I’ll have to look into it and see if I might be able to recreate the problem.
Alexander
-
March 6, 2020 at 21:37 #29013
I’m Not using any formulas or Functions yet. In my custom JS I just have:
var myCAML = “<Value Type=’Integer’>1</Value><Value Type=’Integer’>4</Value>”;
I have also tried adding more quotes but it just made it worse.
-
March 7, 2020 at 09:57 #29015
I have confirmed that this is a bug and will fix it in the next release – maybe later this weekend or early next week.
PS: My previous comment about the Write your own CAML-query field had to contain <Where> was wrong – as long as this field is not empty, the custom CAML will be used.
Alexander
-
March 10, 2020 at 15:13 #29058
Thanks Alexander,
While on the Subject of vars, Can we use the {var:name_of_Var} in the “BaseUrl of the list” on the Cascading dropdowns?
I reviewed the change log and only found where it could be used in the list values.
I am finding that having a var for the Site here would be extremely helpful.Thanks,
Tricia -
March 10, 2020 at 17:16 #29061
This is currently not an option, but I’ll add it in the next release.
You can however write the entire function call in Custom JS – look at the documentation linked in the top of the Cascading dropdown tab in DFFS config.
Alexander
-
March 10, 2020 at 17:23 #29063
Thanks Again Alexander! I have done it before. Just can be a bit of a pain when you have that nice UI tab I could use instead. Thanks for adding to the next release! I’m really looking forward to this next release now. 🙂
-
-
AuthorPosts
- You must be logged in to reply to this topic.