sc_link(Column, Application, Parameters, "Hint", "Target", Height, Width)

Allows you to dynamically create a field connection between two applications.

Note: This macro is only available in Query.

Below is the list of macro parameters, which must be informed separated by commas.

Parameter Value Description
Column

Accepts only string with or without quote protection.

For example: 

sc_link(customerid, form_customer, custom={customerid}, "Customer Data", "_self");

Accepted ways of passing the parameter:

  • customerid
  • 'customerid'
  • "customerid"

Mandatory parameter, where the name of the field that will be transformed into a link to the other application must be informed.

Note: If the informed field already has a field link, the link defined in the macro will overwrite the interface link.
Application

Accepts strings with or without the protection of quotes, in addition to global or local variables.

For example: 

$var_customer = 'form_customer';

sc_link(customerid, $var_customer, custom={customerid}, "Customer Data", "_self");

Accepted ways of passing the parameter:

  • form_customer
  • 'form_customer'
  • "form_customer"
  • $var_customer
  • [glob_customer]

Required parameter, defines the target application of the call.

In this parameter it is possible to use variables making it possible to change the target application, depending on your business rule.

Parameters

This parameter defines the value of the variable that will be available from the target application as a global variable.

For example: 

sc_link(customerid, form_customer, custom={customerid}, "Customer Data", "_self");

Accepted ways of passing the parameter:

  • custom = {customerid}
  • custom = 'ALFKI'
  • custom = $var_customer
  • custom - [glob_customer]

This parameter is not mandatory, but its use is necessary for the correct display of data in the target application. When not informed, the target application will display all data in the table.

Retrieving the value in the target

application In the target application of the connection, in the example on the side is the form_customer application, the custom must be retrieved as a global variable in the application's SQL.

In this example, the following SQL statement has been added to the form (form_customer)

customerid = '[custom]'

For more details on global variable usage, access our online documentation.
Hint

Accepts string, with or without the protection of quotes, lang and global or local variables.

For example: 

sc_link(customerid, form_customer, custom={customerid}, "Customer Data", "_self");

Obs: To use commas and apostrophes in the text, it is necessary to protect with the scape "\"

Accepted ways of passing the parameter:

  • "Help text\, with a comma"
  • 'Customer
  • Data' Customer Data
  • {lang_text}
  • [glob_txt]
  • $ var_txt

This parameter is not mandatory.

Receives a text with some help or remark for the system user, the text is displayed whenever the mouse cursor passes over the link.

It is possible to use langs for the definition of messages, allowing the translation of your system.

Obs: To use commas and apostrophes in the text it is necessary to protect with the scape "\"
Target

This parameter accepts only string. Available values ​​are listed below.

For example: 

sc_link(customerid, form_customer, custom={customerid}, "Customer Data", "modal", 850, 600);

Note: If omitted, the value "_self" will be assigned.

Accepted ways of passing the parameter:

  • "_self"
  • "_blank"
  • "iframeT"
  • "iframeL"
  • "iframeR"
  • "iframeB"
  • "modal"

Defines the way to open the target application.

  • _self - Runs the target application on the same page, overlapping the query application;

  • _blank - Runs the target application on another page (pop-up);
  • iframeT - Displays the target application in an iframe above the query (Top);
  • iframeL - The target application will be displayed in an iframe to the left of the query (Left)
  • iframeR - The target application will be displayed in an iframe to the right of the query (Right);
  • iframeB - The target application will be displayed in an iframe below the query (Bot);
  • modal - Opens a new window and blocks any interaction in the main window;
When using any of the iframe or modal to open the application, it is possible to define the height and width by adding the values ​​in the optional parameters below.
Height

This parameter accepts only numerical values ​​and its unit of measurement is pixel.

For example: 

sc_link(customerid, form_customer, custom={customerid}, "Customer Data", "modal", 850, 600);

Non-mandatory parameter, available only when using the Iframe and modal parameter Target

Defines the height of the iframe or modal where the target application will be displayed.

Note: If omitted, the default value will be 440
Width

This parameter accepts only numerical values ​​and its unit of measurement is pixel.

For example: 

sc_link(customerid, form_customer, custom={customerid}, "Customer Data", "iframeB", 850, 600);

Non-mandatory parameter, available only when using the Iframe and modal parameter Target

Defines the width of the iframe or modal where the target application will be displayed.

Note: If omitted, the default value will be 630

 


Examples

Ex. 1: Creates a link to the costumer.php application, on the Id field, passing the global variable [global_costumer] as and the product field (local variable) {Id} to the costumer.php application:

sc_link(Id, costumer.php, product=[global_costumer]; Id={Id}, "Client Data", "_blank");


Ex. 2: Creating a dynamic link to another application depeding on the field valor {costumer_type} and opening it in a modal.

if ( {costumer_type} == "F") {

    sc_link (costumer_type, type_f.php, product=[global_costumer]; Id={Id}," Personal Data ", "modal", 500, 700);

} else {

    sc_link (costumer_type, type_a.php, product=[global_costumer]; Id={Id}," Company Data ", "iframeR");

}


Ex. 3: Creating a link to a URL. A redirect to the given URL will be performed.

sc_link (my_field, http://www.scriptcase.com, ,"hint of the link", "_blank");