AMT Help Files

Application Link

By adding an application link to an object within your application, it is possible to request data through a form that is part of another AMT application. Your application sees the other application as a blackbox, and can therefore only use the possibilities that are implemented within the requested form. Also the end user can not see the external form.

The communication between two AMT applications always goes from an applications form, report or global routine to a specific form in the other application. The link is specified in the form, report or global routine of the calling application. There is no connection defined within the called application.

Below, you can see how an application link can be created. These steps are explained with an example, in which an application link is created for a form called "CUSTOMERS2CUSTMAN" to the exemplary form "CUSTOMER" in the application CUSTOMER_MANAGEMENT. This link makes it possible to display the records that are read from the listboxes in the form "AMT_CUST".

The layout for the form "CUSTOMER" in CUSTOMER_MANAGEMENT looks as follows. In the example, we will look at this form as a black box, so we will not look into its source code. Actually, this is the same approach as the routine itself, which uses the same interface as a user who works within that specific screen.



Create a new object (form, global routine or report) or open an existing one, to link to an external form.

In this example, we created a new form with the name "APPLINK_DEMO". The listbox on this form is called "Customer", and will be used to display the customer data. The layout for this form looks as follows:



Start the "Add new application link wizard".

To do this, open the form and select "Application Link". Next, choose the option "Add new application link wizard". Instead, it is also possible to add an application link with the option "Add new application link" or by choosing "insert" after clicking the right mouse button. Please note that the procedure for these options is slightly different.



Select the external application that you want to link.

In the example below, we choose "CUSTOMER_MANAGEMENT". Click "Next" to continue.



Choose the name of the object within the external application, that you want to link.

In the example below, we choose "CUSTOMER". Click "Next" to continue.

Fill in a name for the link.

e.g. "CUSTOMER_MANAGEMENT_CUSTOMER".

After clicking "finish", the link will be added, and the field properties will be displayed.

Eventually, edit the displayed fields that are related to the external form or add new fields.

To add a record, right click and choose "insert" from the popup menu. To edit a record, select it and make the changes in the object inspector. To delete a record, select it and choose "delete" from the popup button (or click the delete key).

The following field properties can be set. These properties must be equal to the properties of the original fields in the external application form:

Option:

 

Description:

 

Value:

 

Name

 

The name of the field to link to the external application.

 

text

Type

 

The field type.

 

(Types that have a fixed length)
alpha

(types that don't have a fixed length)
string

 

Length

 

The maximal length of the field.

 

integer

Decimals

 

The decimal length of the field. The decimal length is a part of the maximal length.

 

integer

Comments

 

Comments by the programmer, meant for own use.

 

text


In the image below you see how the fields in the application link buffer are defined within the object "CUSTOMER".



Modify the code.

The wizard automatically creates a routine to establish the link. In the implementation section, this routine can be seen and modified.

After a few modifications, our routine "APPLINK_DESTCUSTOMERREQ" looks as follows:

routine applink_destcustomerreq
var
  applinkstatus : string
  listno        : numeric 2
begin_routine
  with customer_management_customer
    .cust_no := 1
    loop for listno := 1 to 10
      .button_action := 'I'
      call ('customer_managment''customer'customer_management_customerapplinkstatus180)
      if applinkstatus = ''
        if .cust_no <> 0
          fillbox ('APPLINK_DEMO.Customer', .firstname + ' ' + .lastname + ' ' + .city + ' ' + .tel_no)
        endif
      else
        break
      endif
      .cust_no := .cust_no + 1
    endloop
  endwith
end_routine

If the end user clicks the button "INQ" in the screen "APPLINK_DEMO" of the generated application, the screen will be submitted and the MAIN routine will be executed. This routine will read the button value "I", and therefore start the routine "APPLINK_DESTCUSTOMERREQ", which is described above. This routine retrieves the details of the first 10 customers and displays them in the listbox.


When using multiple copies of the same application (e.g. from using the Application Installer) as destination for application link calls, you can only use a single application link in the calling application without the use of the 'remote call' option via an Alias.
This is because copied application have form libraries with the same identifiers (.Net fully qualified type names). When not using the 'remote call' option, it will become unpredictable from which copied application the form libraries will be used. The 'remote call' option should be used in this case.