XPage view column - how can I get values from the current document for a computed URL?

I currently have view with documents containing two fields - “Title” and “TargetLink”.

On an XPage, I want a view control showing only the Title of every document as a link, and the link URLs should be the TargetLink field.

Using this post as a guide, I tried doing the following:

In the view properties, I set data->var to “rowData”.

In the column properties, I set data->pageUrl to be computed on page load with the script
“rowData.getDocument().getItemValueString(‘TargetLink’)”

When I try the XPage in a browser, I get the error lines:

Error while executing JavaScript computed expression

Script interpreter error, line=1, col=9: Error calling method ‘getDocument()’: ‘rowData’ is not a valid object

It then shows my pageUrl script as the line on which the error occurred, so it seems as if the “rowData” var either doesn’t exist at all, or is out of scope.

Can this be done? If so, how?

Subject: I figured it out…

It seems the row data is only available to properties set to “compute dynamically”.

At least for the pageUrl property, my code works for “compute dynamically”, but fails for “compute on page load”.

Subject: actually, you’re close…

I think you’re just putting the code in the wrong place

The snippet you need could be something like this:

var link = rowData.getDocument().getItemValueString(‘TargetLink’);

return “html link

BUT … this needs to be the computed expression for the “value” property on the column in question

The column needs to be set as “display as HTML”

AND

“rowData” needs to set as the “var” property value on the view panel

If all these things are in place, then you should be all set