Dynamically setting View Query
Posted: 16 Jan 2015
Hi I'm using your Related items Lookup on a large list of contacts. Each contact in the list has an associated project. Im trying to lookup the contacts associated with a project.
This works fine for lists of less than 5000 items but on large lists i get no results.
My thought is that if i could in someway dynamically set the Query used in the view of this lookup to match the project name in the form to the project name in the list it would dynamically create a view of less then 5000 items and the related items lookup would work.
I can view the code of the view in SPForms Designer under Extended>View:
<View>
<ViewFields>
<FieldRef Name="Edit" />
<FieldRef Name="Title1" />
<FieldRef Name="FirstName" />
<FieldRef Name="LastName" />
<FieldRef Name="JobTitle" />
<FieldRef Name="ol_Department" />
<FieldRef Name="CompanyLookup" />
<FieldRef Name="ClientOffice" />
<FieldRef Name="Created" />
<FieldRef Name="Modified" />
</ViewFields>
<ViewData />
<Query>
<Where>
<Eq>
<FieldRef Name="FirstName" />
<Value Type="Text">Matthew</Value>
</Eq>
</Where>
</Query>
<Aggregations Value="Off" />
<RowLimit Paged="TRUE">30</RowLimit>
<Mobile MobileItemLimit="3" />
<Toolbar Type="Standard" />
<XslLink Default="TRUE">main.xsl</XslLink>
<JSLink>clienttemplates.js</JSLink>
</View>
But is it possible to change the value of <Value Type="Text">Matthew</Value> in the query to match the content of a field in the form?
Thanks for your help.
Matt.
This works fine for lists of less than 5000 items but on large lists i get no results.
My thought is that if i could in someway dynamically set the Query used in the view of this lookup to match the project name in the form to the project name in the list it would dynamically create a view of less then 5000 items and the related items lookup would work.
I can view the code of the view in SPForms Designer under Extended>View:
<View>
<ViewFields>
<FieldRef Name="Edit" />
<FieldRef Name="Title1" />
<FieldRef Name="FirstName" />
<FieldRef Name="LastName" />
<FieldRef Name="JobTitle" />
<FieldRef Name="ol_Department" />
<FieldRef Name="CompanyLookup" />
<FieldRef Name="ClientOffice" />
<FieldRef Name="Created" />
<FieldRef Name="Modified" />
</ViewFields>
<ViewData />
<Query>
<Where>
<Eq>
<FieldRef Name="FirstName" />
<Value Type="Text">Matthew</Value>
</Eq>
</Where>
</Query>
<Aggregations Value="Off" />
<RowLimit Paged="TRUE">30</RowLimit>
<Mobile MobileItemLimit="3" />
<Toolbar Type="Standard" />
<XslLink Default="TRUE">main.xsl</XslLink>
<JSLink>clienttemplates.js</JSLink>
</View>
But is it possible to change the value of <Value Type="Text">Matthew</Value> in the query to match the content of a field in the form?
Thanks for your help.
Matt.