Returns a character string with a URL format.
Link(Object | URL [ , Par1 , ... Parn ] )
Where:
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.
Type Returned:
Character
Objects:
Procedure,
Transaction,
Web Panel,
Panel, Data Provider
Generators:
.NET Framework, .NET,
Java,
Apple,
Android,
Angular
This function returns a string to be used later in different scenarios (typically to add a link to a UI Control, or invoke an internal or external resource).
Use case 1: Add a link (known Web Object) to a UI Control
&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 property set to Yes), 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: Create a link from a Web Object and invoke it
&MyLink = Link(MyObject,&Parm1, &Parm2)
Link(&MyLink) //The link command is used to invoke the link, without returning any values.
&MyObject = 'Module1.MyObject'
&MyLink = Link(&MyObject,&Parm1, &Parm2)
Link(&MyLink) //The link command is used to invoke the link, without returning any values.
MyObject can be a Web Panel object, Transaction object, Web Component object (with URL access property set to Yes).
Use case 4: Create a link from a known Object and invoke it
&MyLink = Link(MyObject,&Parm1, &Parm2)
call(&MyLink)
&MyObject = 'Module1.MyObject'
&MyLink = Link(&MyObject,&Parm1, &Parm2)
call(&MyLink)
MyObject can be a Panel object, Work With pattern and Work With object.
Note about use cases 1 to 4: Recommended Coding style: Write 'MyObject.Link(Parm1,Parm2)' instead of Link(MyObject,Parm1, Parm2) when the linked object is known at design time.
Use case 5: Link 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 6: Link resources of another site
6.1: Protocol-relative
&MyLink = Link(!'//example.com:80/mypath/folder1',&Parm1, &Parm2)
6.2: Absolute
&MyLink1 = Link(!'https://example.c:80/mypath/document',&Parm1, &Parm2)
&MyLink2 = Link(!'http://user:pwd@example.com:80/mypath/document',&Parm1, &Parm2)
&MyLink3 = Link(!'myscheme://example.com:80/mypath/document',&Parm1, &Parm2)
- If the URL to be linked is stored in an attribute, you can write:
for each Company
&MyLink = link(att:CompanyURL)
//do something with &MyLink
endfor
- Rewrite rules: When there are rewrite rules in the KB (i.e., at least one URL Rewrite object), all URLs are handled at runtime as server-relative URLs because it is required to avoid potential URL 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 for Environments determines how URLs are built when they have parameters. Thus, the link function result also takes into account this property.
Link command
CreateFromURL function
Call Variable