get values from another sharepoint list
AnsweredI have a form that makes use of three lists:
List1 - Purchase Request
List 2 - Purchase Request Details
List 3 - Project Business Unit
List 4 - Project
The form has List 1 as the primary list with List 2 as the sublist.
List 2 has a column Project Business Unit that is a lookup to List 3 column ProjectBU. The Project Business Unit column has a value like 1111 - CORP which consists of a project code and business unit joined together. List 3 also has the values for project and business unit as separate columns.
From the project column on List 3 I need to access List 4 to retrieve some values using the project column on list 4.
I need to retrieve each of the values seperately and show them in the List 2 on the form as soon as the project / business unit is selected.
I have tried doing this via a calculation on the sublist column using a CAML query but I always get a null returned.
window.projectCode = [[@SubListCurrentRow.EPFRDetails.PCMU]].toString();
window.project = window.projectCode.substring(0,4);
return [[@Web.GetFirstValueForQuery('Project', '<Where><Eq><FieldRef Name="Title" /><Value Type="Number">[window.project]</Value></Eq></Where>', 'StrategicPriority')]];
Any help would be appreciated.
Thanks Sandy
-
Hello,
You are using the correct approach but you just should adjust the expression.
The syntactically correct expression is:
return [[@Web.GetFirstValueForQuery('Project', '<Where><Eq><FieldRef Name="Title" /><Value Type="Number">[[=([[@SubListCurrentRow.EPFRDetails.PCMU]].toString().substring(0,4))]]</Value></Eq></Where>', 'StrategicPriority')]];Note: are you sure that the Title field is of type Number?
Name="Title" /><Value Type="Number"0
Please sign in to leave a comment.
Comments
1 comment