How to display multiple links dynamically on an Xpage?

Hello experts,

I am stuck in the below problem and would appreciate any help that I can receive from you all.

Scenario -

I am creating an application using XPages in which one document can have related documents(which use the same form). I use the Xpage to display the document. On this Xpage, I would like to show links to all the documents to which the current document is related. So when I click on one of the related document’s link, it should redirect me to the corresponding document. I am able to get a text list containing the related documents’ titles and their corresponding UNIDs. A document can have any number of related documents.

Question-

How can I create and display links for each of the related documents in the parent document?

Appreciate your help!!!

Subject: Wrap your text in HTML?

  • It sounds like you have all the information you need to build a link the old fashioned way. Simply output your list and put anchor tags around each one.

  • If you are using a repeat control for your view this is pretty trivial. If you aren’t, I’m not much help.

Hope this helps…

Subject: Used repeat control to display multi value field

Thanks David.I used repeat control to display the multiple values of a field and it worked perfectly!

For the links part, I used anchor tag to make each value a link.

Sample code for computed value in the repeat control -

for (var i=1; i<=@Elements(rowData); i++) {

"<a href="+"xp_Document.xsp?action=openDocument&documentId="+@Right(@Left(@Element(rowData, i),"#4"),"#3")+">" + @Left(@Element(rowData, i),"#1") + "</a>" + "<BR />";

}

Note: rowData is the collection name which has both the value as well as the linked document unid.

Hope this would be useful for a few people.