Link Function

Official Content
This documentation is valid for:
Returns a character string with a URL format. 


Link(Object | URL [ , Par1 , ... Parn ] )

Type Returned:

Object | URL
Is a Transaction, Web Panel, Web Component, Panel, Work with, Image or URL to link.

[ par1 ] ... [ parn ]
The set of parameters to pass to the object or URL.


This function returns a string that is afterward used in different scenarios, generally to afterward add a link to a UI Control, or call an internal or external resource.

Linking Web Objects 

Use case 1: Link a known Web Object on a web layout

&MyLink = Link(MyObject,&Parm1, &Parm2)
Textblock1.Link = &MyLink
&MyObject = 'Module1.MyObject'
&MyLink = Link(&MyObject,&Parm1, &Parm2)
Textblock1.Link = &MyLink

MyObject can be a Web Panel object, Transaction object, Web Component object with URL access, Image object.

Use case 2: Instantiate a Web Component control with a Web Component object

&MyLink = Link(MyObject,&Parm1, &Parm2)
WebComponent.Object = CreateFromURL(&MyLink)
&MyObject = 'Module1.MyObject'
&MyLink = Link(&MyObject,&Parm1, &Parm2)
WebComponent.Object = CreateFromURL(&MyLink)

MyObject can be a Web Component object.

Use case 3: Link or call a known Web Object

&MyLink = Link(MyObject,&Parm1, &Parm2)
&MyObject = 'Module1.MyObject'
&MyLink = Link(&MyObject,&Parm1, &Parm2)

MyObject can be a Web Panel object, Transaction object, Web Component object with URL access.

Linking Panels

Use case 4: Call a known Panel

&MyLink = Link(MyObject,&Parm1, &Parm2)
&MyObject = 'Module1.MyObject' 
&MyLink = Link(&MyObject,&Parm1, &Parm2) 

MyObject can be a Panel objectWork With for Smart Devices object

Notes related to the uses case 1 to 4

  • Recommended Coding style: Write  'MyObject.Link(Parm1,Parm2)' instead of  Link(MyObject,Parm1, Parm2) when the linked object is a known at design time

Linking external resources

Use case 5: Linking resources of the same site

You can use the link function to get a link to an external resource of the same site. 

5.1: Document Relative

&MyLink = Link(!'mypath/document',&Parm1, &Parm2) 

Compatibility note specific to Java generator: If the linked URL is a file (e.g. 'mypath/myspreadsheet.xlsx'), the resulting string is server relative.

5.2: Server Relative

&MyLink = Link(!'/mypath/document',&Parm1, &Parm2) 

Use case 7: Linking resources of another site

6.1: Protocol Relative

&MyLink = Link(!'//',&Parm1, &Parm2) 

6.2: Absolute 

&MyLink1 = Link(!'https://example.c:80/mypath/document',&Parm1, &Parm2) 
&MyLink2 = Link(!'',&Parm1, &Parm2)
&MyLink3 = Link(!'myscheme://',&Parm1, &Parm2)


if the URL to be linked is stored in an attribute you can write 

for each
    &MyLink = link(att:CompanyURL)


  • Rewrite rules: When there are rewrite rules in the kb (ie at least one URL Rewrite object) all URLs are handled at runtime as server relative URLs because it is required to avoid potential URLs ambiguity.  Therefore, in that case, the link function applied to a relative URL always returns a server relative URL.
  • Parameter style: The Parameters Style property determines how URLs are built when having parameters, thus, the link function result takes into account this property also. 


Objects: Procedure object, Transaction object, Web Panel objectPanel object
Platforms: .NET, .NET Core, Java, Apple, Android, Angular

See Also