Page 1 of 1

display two columns in Manage Plumsail Lookup

Posted: 01 Oct 2015
by RMIC
Hello,

I have in a list a Manage Plumsail Lookup.
How can I view two columns within this Manage Plumsail Lookup Show?
Currently I have under format Item:
function(item) {
return '<span class="csl-option">' + item["{LookupField}"] + '</span>'
}

I have the article "Setting up the view of results in Cross-Site Lookup Column" (http://spform.com/office-365/sett ... office-365) read, but I do not come forward.

I want me display two text columns.

Many thanks!

Re: display two columns in Manage Plumsail Lookup

Posted: 02 Oct 2015
by rostislav
To display values of two columns inside the Cross Site lookup dropdown box:

1. Add the fields to the Request query. Here I'm adding two fields called 'anothercolumn1' and 'anothercolumn2' to my query:

Code: Select all

function (term, page) {
  if (!term || term.length == 0) {
    return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},anothercolumn1,anothercolumn2&$orderby=Created desc&$top=10";
  }
  return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},anothercolumn1,anothercolumn2&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "')&$top=10";
}
2. Add the fields to the item format function:

Code: Select all

function(item) {
  return '<span class="csl-option">' + item["{LookupField}"] + '  ' + item['anothercolumn1'] + '  ' + item['anothercolumn2'] + '</span>'
}
Note that the names of the fields must be InternalNames, not titles (you can check in Forms Designer the internal name for a field).

If you want to also display multiple values inside the actual box (not the dropdown list), then you can add a calculated field with a formula like this:

Code: Select all

[anothercolumn1]&" - "&[anothercolumn2]
and use it as the lookup field.

If you then want to filter the result set based on multiple fields check the following forum thread, especially starting from message #7
viewtopic.php?f=1&t=540

Re: display two columns in Manage Plumsail Lookup

Posted: 15 Oct 2015
by RMIC
Thanks!