Links

Geschätzte Lektüre: 10 Minuten

Introduction

A link enables data records of two tables to be linked.

Limbas automatically creates an additional ‘Internal Link Table’ for 1:n and n:m links. The name of this ‘Internal Link Table’ is displayed in the table settings ([admin]-> [tables]) , in the ‘Addition’ field. The unique field ‘ID’ of the ‘Table A’ is linked with the field ‘ID’ of the ‘Internal Link Table’ and the field ‘VERKN_ID’ of the ‘Internal Link Table’ is linked with the unique field ‘ID’ of the ‘Table B’. In addition, table status information such as ‘created on’ ‘created by’ is stored.

Create a Link

To create a link, add a field of type “link 1:n” or “link m:n”. You can select the table you want to link in the link-editor.

To create a 1: 1 link, the table to be linked must be selected when creating a table.

Using the link editor ([Admin]->Any Table, see right), you can select the table you want to link.

The content of the new field with the type “Link 1:n” or “Link m:n” is in the background a numeric number which contains the number of the current links of the respective data record. The content is updated via a database driver when the link is modified (add or remove). This method has the advantage that the representation in the table list does not have to resolve each link individually, but can directly display the number of links and is therefore significantly faster. A possible inconsistency over time can be renewed manually using the system tools.

Manage Links

Additional settings for the link can be made, using the three tabs in the link editor.

General

Fig.: link editor

Linked

Select a table field in the linked table. When the data record is displayed this field will represent the linked table in the Edit and Detail View. Chose a field with a relevant content .The field has no relevance for the ‘real link’ and can be changed at any time.

Searchable

Select any number of fields in the linked table. When a search is performed in the actual table, the contents of these fields will be checked, to find data records, where the link contains the search strings.

Fig.: You can search for the first name, even though only the last name is displayed

Search Result

Any number of fields can be selected from the table fields in the linked table. The result of a quick search, in the Edit View of a data record of the actual table, displays the contents of the selected fields in a drop down list, separated by ‘|’. A quick search is only possible when ‘ajax search’ is enabled for the link.

Fig.: The name and first name are displayed

Displayed

Each user can individually select any number of table fields from the linked table, which are then displayed in the Edit and Detail View of the actual table. This setting is then used as default.

Fig.: The Ajax search displays the name and first name

Seperator

The user has the option to specify 2 separators:

Fig.: The first separator separates the values that appear in the quick search.
Fig.: The second separator separates the values displayed in the table view.

Referential Integrity

Referential integrity is a property of data which, when satisfied, requires every value of one column of a table to exist as a value of another attribute in a different (or the same) table. If referential integrity is enabled, a corresponding foreign key is created (see also Constraints). .

By using link parametrisation, the user can add values to links. After activating the function and resetting, the user can create new columns in the automatically published table “tablename_params”. The Field Types are however limited.

These values cannot be exported and cannot be accessed through SOAP in this Limbas version.

Fig.: 1
Fig.: 2
Fig.: 3
Fig.: 4
Fig.: 5
Fig.: 6

Hierarchical links are cross-table links. As soon as such a link is possible, the option appears automatically in the link settings.

It is possible if the table to be linked is already linked to a field in the existing table.

It should be noted that fields that are linked in this way can only be read only read , but can otherwise be used as usual.

Advanced Filters

(see also Example Link)

When creating a link to an existing data record, without an advanced filter, all data records of the linked table will be listed. To eliminate irrelevant results conditions can be set in the advanced filter. Where these conditions are fulfilled the data records will be listed. There are two possible ways:

  • Set the variable corresponding to the SQL clause “$where []” and “$from []”. Click on the arrow to get a drop down list with all relevant tables for the current link where the links are displayed in pairs. By clicking on one of these pairs, a query is proposed.
  • Set filter settings using the “$gsr”-Parameter (see the description of the function “get_gresult”).
  • Set filter by using your own function “return myExt_function($gtabid,$utyp,$filter,$gsr,$verkn,$onlyfield=null,$single=null,$extension=null)”. By “return”ing, the standard function get_sqlquery() will be aborted and replaced by your own function. You are advised to call the original function to get to know the format of the data.

Generator

To generate links for tables, imported from an external database. First select from each of the 2 tables a table field. If the selected table fields have the same content, Limbas creates a link for these 2 data records. The generator automatically generates and fills the “Internal Link Table”.

Back-Link

A Back-Link can show a link in both directions.

To make that possible, Limbas creates a “View Table”, where “ID” and “VERKN_ID” are swapped.

Types of Links

The ‘1: n link’ is the most common type of link. Only ONE customer can be linked with several contacts. But a contact can be linked only to ONE customer Additional information such as ‘created on’ and ‘by whom’ are saved in a 3rd table, the “Internal Link Table”.

Several orders can be linked to several articles, an article can be linked to several orders.

This is only possible by defining a third table (which is called the “Internal Link Table”) whose primary key consists of two fields: The foreign keys from tables A and B. An “n:m link” actually consists of two 1:n-links with a third table.

ONE customer can be linked with ONE contact, ONE contact can be linked with ONE customer.

This type of link is rarely used, because most of the information linked in this way, is within a single table. Limbas uses those links

Display

The display of a link can be changed in the table field settings

Fig.: table field settings

Links can be displayed in different ways:

  • Standard
Fig.: standard-view
Fig.: standard-view unique

In the standard display, the links are listed in detail in a table. Links can be extracted, searched, sorted and edited. If ‘Ajax search (Tables) is enabled, an input field is displayed and data records in the linked table can be quickly searched and linked.

  • Selection Search
Fig.: Selection Search
Fig.: selection-search unique

If ‘Selection search’ is enabled, the link is displayed as a simple list or as a select field if ‘unique’ is activated.

  • Ajax Search
Fig.: Ajax Search
Fig.: Ajax Search unique

If ‘Ajax search’ is enabled in addition to ‘Selection search’, you can see all possible datasets by typing “*” into the ajax text field.

If “unique” is activated, only one dataset can be selected.

In addition you can select whether a linked dataset in list view should be displayed in detail (Fig1) or in shortform (Fig2) or only the first (Fig3) or last (Fig4):

Verknuepfungen Abb29.png
Fig.: 1
Verknupfungen Abb2.png
Fig.: 2
Verknupfungen Abb3.png
Fig.: 3
Verknupfungen Abb4.png
Fig.: 4

Parameters

If a link is displayed in a separate form, additional settings are possible via the context menu and the item “Parameter”:

Display defined fields (if rights are granted)

$filter["ext_RelationFields"][$vuniqueid] = array(10,7,15,13,14,16,19,23);

Edit defined fields (if rights are granted)

$filter["ext_RelationFields"]["edit"][$vuniqueid] = array(16,19,23);

Define Column width (in pixel)

$gfield[$vgtabid]["rowsize"][16] = 20;

Limit Results (Search Parameter)

$gsr[$vgtabid][22][0] = $ID;
$filter["ext_RelationFields"]["searchval"][$vuniqueid] = $gsr;

Sort

$filter["ext_RelationFields"]["order"][$vuniqueid][0] = array(4,13,"ASC");
$filter["ext_RelationFields"]["order"][$vuniqueid][1] = array($vgtabid,4,'DESC');

Hide Functions

return array('no_search' => 1,'no_add' => 1,'no_edit' => 1,'no_delete' => 1,'no_link' => 1,'no_sort' => 1,'no_openlist' => 1,'no_fieldselect' => 1);

Show all results

$filter["ext_RelationFields"]["showall"][$vuniqueid] = 1;

Show content of ‘Long fields‘

$filter["ext_RelationFields"]["getlongval"][$vuniqueid] = 1;
Share this Doc

Links

Or copy link

CONTENTS