Home › Forums › vLooup for SharePoint › vLookups stopped working in list Edit form
- This topic has 6 replies, 2 voices, and was last updated 8 years, 6 months ago by Gerard Graham.
-
AuthorPosts
-
-
April 29, 2016 at 13:56 #11327
Hi there
I’ve implemented vLookup across a number of lists but just realised that for those in the root of my site collection, all vLookups are not working while in the edit form. They all work in the display forms, returning results as expected, but no results at all in the Edit forms. Lists in sub sites are working as expected with the vLookups working in both Edit and Display forms.
Any idea where the problem lies? I’m on DFFS 4.365 and vLookup 2.266
Regards
Gerry
-
April 30, 2016 at 09:16 #11339
I have a hunch it could be the “List base URL”, but if you append “&vLookupDebug=1” to the URL you can “see” the query and the output:
Example:
/Lists/DFFS_TestList/DispForm.aspx?ID=123&vLookupDebug=1
Post the output here.
Alexander
-
May 3, 2016 at 09:09 #11357
Hi Alexander
First is the output from the Edit form followed by the output from the Display form for the same item.
Thanks
Gerry
Edit
Field: vLookupDivisionsblob:
{“noteToSelf”:””,”listName”:”ContDB-Divisions”,”listBaseUrl”:”/celcis”,”query”:{“fin1″:”Org”,”type1″:”Text”,”value1″:”,”,”fin2″:””,”type2″:”Text”,”value2″:””,”fullCAML”:””,”AndOr”:””,”operator1″:”Eq”,”operator2″:”Eq”,”orderBy”:”ID”,”rowLimit”:””},”childTableHeight”:””,”viewFields”:[{“fin”:”Title”,”settings”:””,”disp”:{“default”:””},”colWidth”:””,”colWidthOperator”:”px”},{“fin”:”City”,”settings”:””,”disp”:{“default”:”City”},”colWidth”:””,”colWidthOperator”:”px”},{“fin”:”Contacts”,”settings”:””,”disp”:{“default”:”Contacts”},”colWidth”:””,”colWidthOperator”:”px”}],”action”:”concat”,”action_groupBy”:””,”action_groupByHeaderStyle”:””,”action_groupByExpanded”:false,”action_groupByPrefix”:{“default”:””},”showTotals”:false,”openInDlg”:true,”disable”:false,”refreshAllOnCallback”:false,”viewItemLinkIn”:{“disp”:true,”edit”:true,”view”:true},”editItemLinkIn”:{“disp”:true,”edit”:true,”view”:true},”hideLabelInForm”:true,”label”:{},”moreItemsLabel”:{“default”:””},”noItemsLabel”:{“default”:””},”addNew”:true,”newItemInDlg”:true,”addNewDlgOpt”:{“width”:””,”height”:””,”x”:””,”y”:””,”allowMaximize”:false,”showMaximized”:false,”showClose”:false,”autoSize”:false},”addNewLabel”:{“default”:”New Division”},”addNewIn”:{“disp”:true,”edit”:true,”view”:true},”addNewFolder”:false,”addNewFolderLabel”:{“default”:””},”addNewFolderIn”:{“disp”:false,”edit”:false},”addNewDocLabel”:{},”inUrl”:[{“from”:”Title”,”to”:”Org”,”hide”:false}],”folderMetadata”:[],”uploadToFolder”:true,”uploadToFolderLabel”:””,”openFolder”:true,”openFolderLabel”:””}
Field: vLookupDivisionsquery:
<View Scope=’RecursiveAll’><Query><Where><Eq><FieldRef Name=’Org’ /><Value Type=’Text’>,</Value></Eq></Where><OrderBy><FieldRef Name=’ID’ /></OrderBy></Query></View>
Field: vLookupDivisionsNumber of items matching the query: 0
Display
Field: vLookupDivisionsblob:
{“noteToSelf”:””,”listName”:”ContDB-Divisions”,”listBaseUrl”:”/celcis”,”query”:{“fin1″:”Org”,”type1″:”Text”,”value1″:”A Life Explored”,”fin2″:””,”type2″:”Text”,”value2″:””,”fullCAML”:””,”AndOr”:””,”operator1″:”Eq”,”operator2″:”Eq”,”orderBy”:”ID”,”rowLimit”:””},”childTableHeight”:””,”viewFields”:[{“fin”:”Title”,”settings”:””,”disp”:{“default”:””},”colWidth”:””,”colWidthOperator”:”px”},{“fin”:”City”,”settings”:””,”disp”:{“default”:”City”},”colWidth”:””,”colWidthOperator”:”px”},{“fin”:”Contacts”,”settings”:””,”disp”:{“default”:”Contacts”},”colWidth”:””,”colWidthOperator”:”px”}],”action”:”concat”,”action_groupBy”:””,”action_groupByHeaderStyle”:””,”action_groupByExpanded”:false,”action_groupByPrefix”:{“default”:””},”showTotals”:false,”openInDlg”:true,”disable”:false,”refreshAllOnCallback”:false,”viewItemLinkIn”:{“disp”:true,”edit”:true,”view”:true},”editItemLinkIn”:{“disp”:true,”edit”:true,”view”:true},”hideLabelInForm”:true,”label”:{},”moreItemsLabel”:{“default”:””},”noItemsLabel”:{“default”:””},”addNew”:true,”newItemInDlg”:true,”addNewDlgOpt”:{“width”:””,”height”:””,”x”:””,”y”:””,”allowMaximize”:false,”showMaximized”:false,”showClose”:false,”autoSize”:false},”addNewLabel”:{“default”:”New Division”},”addNewIn”:{“disp”:true,”edit”:true,”view”:true},”addNewFolder”:false,”addNewFolderLabel”:{“default”:””},”addNewFolderIn”:{“disp”:false,”edit”:false},”addNewDocLabel”:{},”inUrl”:[{“from”:”Title”,”to”:”Org”,”hide”:false}],”folderMetadata”:[],”uploadToFolder”:true,”uploadToFolderLabel”:””,”openFolder”:true,”openFolderLabel”:””}
Field: vLookupDivisionsquery:
<View Scope=’RecursiveAll’><Query><Where><Eq><FieldRef Name=’Org’ /><Value Type=’Text’>A Life Explored</Value></Eq></Where><OrderBy><FieldRef Name=’ID’ /></OrderBy></Query></View>
Field: vLookupDivisionsNumber of items matching the query: 1
-
May 4, 2016 at 07:39 #11365
Hi,
The query is not the same in the two “blobs” above so I’ll have to see a screenshot of the vLookup setup (the CAML query part).Alexander
-
May 4, 2016 at 09:17 #11375
Hi there
Is the problem the current item field I’m using? DisplayName is a calculated field.
Gerry
Attachments:
-
May 5, 2016 at 21:42 #11396
Hi,
Yes this is the reason. When using [currentItem:NameOfField] I pull the value from the field in the form when in EditForm – and a calculated column is not present in EditForm.In DispForm I use a query to find all the values, and I’m not sure doing this differently in EditForm makes any sense (you have one more query to perform, but this does not take many milliseconds to complete).
Try putting the code snippet below in the Custom JS in DFFS of your EditForm to see if it makes any difference. Let me know how it works out so I can update the vLookup script if it performs as expected.
Alexander
spjs.vLookup.fillInVariables = function(str,id,listGuid){ var split, finID, fin, viewFields, item, val, vArr, q; finID = {}; viewFields = []; vArr = str.match(/\[currentItem:[^\]]*\]/gi); if(vArr!==null){ spjs.$.each(vArr,function(i,v){ split = v.replace(/\[|\]/g,'').split(':'); fin = split[1]; if(fin!==null){ if(fin==='ID'){ str = str.split(v).join(id); }else{ if(split.length===3){ finID[fin]=split[2]; } viewFields.push(fin); str = str.split(v).join("~"+fin+"~"); } } }); if(viewFields.length>0){ item = spjs_getItemByID({"listName":listGuid,"id":id,"viewFields":viewFields,"scope":"RecursiveAll"}); if(item!==null ){ spjs.$.each(viewFields,function(i,fin){ val = (item[fin]!==null)?item[fin]:''; vArr = val.split(';#'); switch(finID[fin]){ case 'id': val = vArr[0]; break; default: if(vArr.length>1){ val = vArr[1]; }else{ val = vArr[0]; } } str = str.split("~"+fin+"~").join(val); }); } } } // URL vArr = str.match(/\[URL:[^\]]*\]/g); if(vArr!==null){ spjs.$.each(vArr,function(i,v){ split = v.replace(/\[|\]/g,'').split(':'); q = split[1]; if(q!==null){ if(GetUrlKeyValue(q) !== ""){ str = str.split(v).join(GetUrlKeyValue(q)); } } }); } // Variables vArr = str.match(/\{var:[^\}]*\}/g); if(vArr !== null){ $.each(vArr,function(i,v){ try{ val = eval(v.split(":")[1].replace(/\}|\\/g,"")); if(val === undefined){ alert("[vLookup - undefined variable]\n\n"+v.split(":")[1].replace(/\}|\\/g,"")); }else{ str = str.split(v).join(val); } }catch(err){ alert(err); } }); } return str; };
-
May 6, 2016 at 08:07 #11399
Hi there
It works in all the lists I’ve tried it on so far. I realise now I should have been basing the filter on a static field instead, but another new feature added!
Cheers
Gerry
-
-
AuthorPosts
- You must be logged in to reply to this topic.