Related Items filtered by Cross-Site-Lookup-Field
Hello,
I made a form with a related item on it. The field, which sets the filter for the related-item is a cross-site-lookup-field. Unfortunatly when I use data-source-filtering the filter is set on the ID of the lookup-field and not on the value. The code which is visible under "view" is pasted below (Code 1). The filter-field and kookup-field is snr.
In Code 2 I set the filter in the code on static-value 99999. This works and filters the related-item. Only entries with snr = 99999 are shown.
Is there a possibility to filter the related-items by the lookup-value and not by thd ID?
Thank you for your help.
Code 1:
<View>
<ViewFields>
<FieldRef Name="DocIcon" />
<FieldRef Name="LinkFilename" />
<FieldRef Name="Title" />
<FieldRef Name="snr" />
</ViewFields>
<ViewData />
<Query>
<GroupBy Collapse="TRUE" GroupLimit="30">
<FieldRef Name="snr" />
</GroupBy>
<OrderBy>
<FieldRef Name="FileLeafRef" />
</OrderBy>
</Query>
<Aggregations Value="Off" />
<Mobile MobileItemLimit="3" MobileSimpleViewField="LinkFilename" />
<Toolbar Type="Standard" />
<XslLink Default="TRUE">main.xsl</XslLink>
<JSLink>clienttemplates.js</JSLink>
<RowLimit Paged="TRUE">30</RowLimit>
<ParameterBindings>
<ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noitemsinview_doclibrary)" />
<ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noitemsinview_doclibrary_howto2)" />
</ParameterBindings>
</View>
Code 2:
<View>
<ViewFields>
<FieldRef Name="DocIcon" />
<FieldRef Name="LinkFilename" />
<FieldRef Name="Title" />
<FieldRef Name="snr" />
</ViewFields>
<ViewData />
<Query>
<GroupBy Collapse="TRUE" GroupLimit="30">
<FieldRef Name="snr" />
</GroupBy>
<OrderBy>
<FieldRef Name="FileLeafRef" />
</OrderBy>
<Where>
<Eq>
<FieldRef Name="snr" />
<Value Type="Text">99999</Value>
</Eq>
</Where>
</Query>
<Aggregations Value="Off" />
<Mobile MobileItemLimit="3" MobileSimpleViewField="LinkFilename" />
<Toolbar Type="Standard" />
<XslLink Default="TRUE">main.xsl</XslLink>
<JSLink>clienttemplates.js</JSLink>
<RowLimit Paged="TRUE">30</RowLimit>
<ParameterBindings>
<ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noitemsinview_doclibrary)" />
<ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noitemsinview_doclibrary_howto2)" />
</ParameterBindings>
</View>
I made a form with a related item on it. The field, which sets the filter for the related-item is a cross-site-lookup-field. Unfortunatly when I use data-source-filtering the filter is set on the ID of the lookup-field and not on the value. The code which is visible under "view" is pasted below (Code 1). The filter-field and kookup-field is snr.
In Code 2 I set the filter in the code on static-value 99999. This works and filters the related-item. Only entries with snr = 99999 are shown.
Is there a possibility to filter the related-items by the lookup-value and not by thd ID?
Thank you for your help.
Code 1:
<View>
<ViewFields>
<FieldRef Name="DocIcon" />
<FieldRef Name="LinkFilename" />
<FieldRef Name="Title" />
<FieldRef Name="snr" />
</ViewFields>
<ViewData />
<Query>
<GroupBy Collapse="TRUE" GroupLimit="30">
<FieldRef Name="snr" />
</GroupBy>
<OrderBy>
<FieldRef Name="FileLeafRef" />
</OrderBy>
</Query>
<Aggregations Value="Off" />
<Mobile MobileItemLimit="3" MobileSimpleViewField="LinkFilename" />
<Toolbar Type="Standard" />
<XslLink Default="TRUE">main.xsl</XslLink>
<JSLink>clienttemplates.js</JSLink>
<RowLimit Paged="TRUE">30</RowLimit>
<ParameterBindings>
<ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noitemsinview_doclibrary)" />
<ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noitemsinview_doclibrary_howto2)" />
</ParameterBindings>
</View>
Code 2:
<View>
<ViewFields>
<FieldRef Name="DocIcon" />
<FieldRef Name="LinkFilename" />
<FieldRef Name="Title" />
<FieldRef Name="snr" />
</ViewFields>
<ViewData />
<Query>
<GroupBy Collapse="TRUE" GroupLimit="30">
<FieldRef Name="snr" />
</GroupBy>
<OrderBy>
<FieldRef Name="FileLeafRef" />
</OrderBy>
<Where>
<Eq>
<FieldRef Name="snr" />
<Value Type="Text">99999</Value>
</Eq>
</Where>
</Query>
<Aggregations Value="Off" />
<Mobile MobileItemLimit="3" MobileSimpleViewField="LinkFilename" />
<Toolbar Type="Standard" />
<XslLink Default="TRUE">main.xsl</XslLink>
<JSLink>clienttemplates.js</JSLink>
<RowLimit Paged="TRUE">30</RowLimit>
<ParameterBindings>
<ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noitemsinview_doclibrary)" />
<ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noitemsinview_doclibrary_howto2)" />
</ParameterBindings>
</View>
Hello Mapleleaf!
You can filter related items view dynamically based on the lookup value, please have a look at this article to get the step by step instructions.
Please follow the setup steps from the article. The code for your fields will be as below.
Is that what you want to develop?
You can filter related items view dynamically based on the lookup value, please have a look at this article to get the step by step instructions.
Please follow the setup steps from the article. The code for your fields will be as below.
Code: Select all
//first filter on page load
setHash();
//and attach an on-change handler that will call the filtering function wherever the value of the field changes
fd.field('snr').change(setHash);
//this is the actual function that filters the list
function setHash(){
//get value
var value = fd.field('snr').control('getSelectedText');
if (value == "(None)") {
value = "";
}
value = encodeURIComponent(escape(value)).replace(/\-/g, "%252D");
window.location.hash = "InplviewHash" + $(".related-issues [webpartid]").attr("webpartid") + '=FilterField=snr-FilterValue=' + value;
}
-
- Information
-
Who is online
Users browsing this forum: No registered users and 15 guests