Function descriptions

Function “init_relation()”

Estimated reading: 3 minutes
array init_relation(numeric $gtabid, numeric $fieldid, numeric $ID, array $rel_add_ID=null, array $rel_del_ID=null, bool $rel_showonly=null,$linkParam=null,rel_type=1,$verbose=null);

Function whose return value is required for the Insert, Delete, and Display of links (./limbas_src/gtab/gtab.lib).

Parameters:

The transfer parameters are inserted, where needed, in the return array.

$gtabid

  • Table ID of the table that contains the field with the link

$fieldid

  • Field ID of the field with the link

$ID

  • ID of the data record, for which data records from the linked table should be added, deleted or displayed.

$rel_add_ID

This transfer parameter is only relevant, if the return value of the function is used as a parameter for the set_relation() function.

  • Null: In the return array, no data records are entered, to be added to the link.
  • Array with the IDs of the data records in the linked table, to be added to the link (E.g. array(2,6))

$rel_del_ID

This transfer parameter is only relevant if the return value of the function is used as a parameter for the set_relation() function.

  • Null: In the return array, no data records are entered to be deleted from the link
  • Array with the IDs of the data records of the linked table, to be deleted from the link (E.g. array(2,6))

$rel_showonly

This transfer parameter is only relevant, if the return value of the function is used as the $verkn parameter for the get_gresult() function.

  • 1: In the return value of the get_gresult() function only records linked to the specified table field by $gtabid, $fieldid and $ID are taken into account.
  • 0, zero: In the return value of the get_gresult() function only data records are taken into account, where the table field specified by $gtabid and $fieldid, is not linked to a data record.

Using this parameter, it is possible to access the values of additional fields in the link table, which have been added manually. The parameter is an array that contains the field name as key and the content as value. This parameter can be also used to show links to the table LDMS_FILES in order to give access to the file system in a specific directory.

array('LID' => 123)

$rel_type

This optional parameter can be 1 or 2 and specifies the direction from which the link is to be created. By default, the link is executed from left to right. So, for example, order -> customer. If all customers of a particular job are to be displayed, the parameter [1] must be. If you want to display all orders for a particular customer, you must use parameter [2].

$verbose

Forces a detailed return of the function “set_joins()” in form of an array after adding or deleting links. Otherwise, the number of changed links is returned.

Return Value:

Array in the format, as it is required as a parameter by the functions (E.g. set_relation(), get_gresult()) to insert, delete, and to display links.

Example

In this example, the order table should have the ID 1 and the customer table the ID 2. Customer is linked via the field with ID 10 to order.

Share this Doc

Function “init_relation()”

Or copy link

CONTENTS