Page 1 of 1

Related Item - Lookup-Field

Posted: 29 Dec 2016
by wdeffner
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

Re: Related Item - Lookup-Field

Posted: 30 Dec 2016
by Dmitry Kozlov
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).

Re: Related Item - Lookup-Field

Posted: 19 Apr 2017
by gaj
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.

Re: Related Item - Lookup-Field

Posted: 20 Apr 2017
by Dmitry Kozlov
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.

Re: Related Item - Lookup-Field

Posted: 25 Apr 2017
by gaj
Works fine :)
thx Dimitry