0

I gave up. The task looked simple:

I have a list with clients with 2 columns: clientname, clientid, URL. I made another list where managers could collect clients from this list that they frequently visit, so they have it at hand all the time, regardless where they are browsing from.

So, made a lookup column in the new list, and wanted to show the customer name and also show the URL. But the URL column is just not there. I can add the URL's as plain text in another column and pull it with the lookup field, but of course, it is not a hyperlink anymore.

I tried it another way:

Pick the clientid and generate the url in a calculated column. But the additionally presented columns are not available for calculations.

So, the question is:

How could I fulfill this simple looking task: In a list, select the name of the customer from another list, add it to a field, and the same time, add the customer url too?

  • You want to show the customer url in the new/edit/display form or, you want to show it in list view? – Ravindra Jul 14 '16 at 12:37
  • Only in the view. During the selection, it is enough if the user sees the customer name. The URL is important only later, when he/she comes back. – vilmarci Jul 14 '16 at 12:49
  • you can join multiple lists together and can create a combined view. You can create this kind of view using a Linked Data Source. – Ravindra Jul 14 '16 at 12:53
0

The Lookup columns (or any complex datatype like user, multiple select) are not available to Calculated Columns.

But (most of) the data is available in the JavaScript ctx.ListData object when the Page is built
(I am not 100% sure SP2010 had the full functionality)

Type

ctx.ListData

in the F12 Dev console to explore what is there

You can use it in a View:

Create a calculated column and paste the Formula, then set the datatype to Date so it executes the HTML

=" <img src=""/_layouts/images/blank.gif"" onload=""{"
    &"var TR=GetAncestor(this,'TR'),"
    &"    item=ctx.ListData.Row[TR.rowIndex-1],"
    &"    console.log(TR.rowIndex-1,item);"
    &"    this.parentNode.innerHTML=item.Title;"
&"}"">"
  • The onload function is triggered once the blank image is loaded.
  • GetAncestor is provided by SP
  • The Table Row has the rowIndex.. but the first table row in the View Table is the Header row

Only drawback of stuffing HTML/Javascript in a Calculated Column is it will show up as text in Forms (can be hidden) and on Email Alerts

Details at www.ViewMaster365.com/#How

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.