Search code examples
xpagesxpages-ssjs

XPages Links: can we compute wether to add parameter or not?


I have a form where users can create "links" in a side box. These links can refer to a document Inside the database or to an external site.

For "internal" links, I am adding a parameter so I can track the click from the side box (needed for stats), but I don't want to add that parameter for external URLs.

I tried computing the param in the properties, but the link is still built adding "/?=" at the end of the URL. Not a big deal, but I'd rather make it clean and just don't add the param part for external URLs.

I can't use the "loaded" property as this param is computed for each link in a repeat control, and I am using a view column in that computation.

Thanks :D


Solution

  • If you don't have a pager, you can set repeatControler="true" on the repeat and then use the loaded property.

    Otherwise you should be able to compute the link, as I do in this Data View, using "Custom language" - combining literal strings and SSJS.