Related Item - Lookup-Field

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
wdeffner
Posts: 30
Joined: Thu Sep 22, 2016

29 Dec 2016

Hi,

we are trying to configure a pretty basic related-items-list in a form. In other situations we had no trouble setting up relatd-items-lists, but here the situation seems to be different:

The Form is setup for List A, which contains a lookup-field that is populated by a calculated field in List B.

We want to use the related-items list to show additional information from List B.

In the data-source-editor we have chosen the correct list and view, "Filter by form field" and the two fields from List A and B.

When we call this form, the related-items list is empty, a message "In this view of "List B" no items can be displayed" (In dieser Ansicht der Liste "List B" sind keine Elemente anzeigbar) is shown.

Just for tests we have created another text field in List A and have filled this with values. When we chose this field for List A in the data-source-editor, everything works fine. Eperiments with using ID as mentioned in "How to filter related items by almost any field" have not been successful.

So the trouble must have something to do with the use of the lookup-field in List A.

Any idea?

Greetings, Wolfgang

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

30 Dec 2016

The problem is that the lookup field is located in the parent list, not in a child as in our samples. So, here you should configure filtering by Lookup-Calculated column in the Data Source editor, then add an HTML-control onto your form, set CDATA property in False and insert the following code into its Content:


<xsl:variable name="LookupValue" select="substring-before(substring-after(@Lookup,'&gt;'),'&lt;')"/>

<xsl:comment>

<xsl:value-of select="ddwrt:GenFireConnection(concat('*', '@Lookup=', ddwrt:ConnEncode(string($LookupValue))), '')" />

</xsl:comment>



Replace @Lookup with the internal name of your lookup field (@InternalName).

gaj
Posts: 40
Joined: Wed Feb 01, 2017

19 Apr 2017

Hi,

My Problem is that when the Lookupvalue contains an "&" (Ampasand) this code don´t work!

How to Change the code to work with "&"?

thx.

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

20 Apr 2017

Hi,

I can recommend you to filter the related list by ID instead of the Title. In the Data source editor, set List field to 'ID' and replace the code in HTML-control with the following:

Code: Select all

<xsl:variable name="LookupValue" select="substring-before(substring-after(@Lookup,'&amp;ID='),'&amp;')"/>
<xsl:comment>
<xsl:value-of select="ddwrt:GenFireConnection(concat('*', '@Lookup=', ddwrt:ConnEncode(string($LookupValue))), '')" />
</xsl:comment>
Replace @Lookup with the @internal name of the lookup field from the List A.

gaj
Posts: 40
Joined: Wed Feb 01, 2017

25 Apr 2017

Works fine :)
thx Dimitry

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests