Anveo Web Portal / Customize the User Interface / Flexible Relations Between Anveo Pages

Flexible Relations Between Anveo Pages

Normally Anveo Client Suite identifies the relation between two Anveo Pages using the table relations which are set up once globally for all Anveo Pages. This setup is done in ”Anveo. For example, the relation between the ”Customer” and the ”Sales therefore do not have to be set manually for every Anveo Page constellation as in .

For more special scenarios in which the relationship between two tables is not to be created via the direct relation from field to field, a C/AL code can be deposited in the codeunit ”ACF function CustomAnveoPageRelation which sets the relationship manually. This makes it possible, for example, to output the related contact for a customer.

The relation described above is defined in C/AL code in the following code example:

// Show related company contact from customer
// Data Source: Customer
// Destination: Contact

// 1. Set table reference
RecRef.SETTABLE(Customer);
Mgt.OPENRecRef(DATABASE::Contact,DestRecRef);

// 2. Filter
ContBusRel.RESET;
ContBusRel.SETCURRENTKEY("Link to Table","No.");
ContBusRel.SETRANGE("Link to Table",ContBusRel."Link to Table"::Customer);
ContBusRel.SETRANGE("No.",Customer."No.");
IF ContBusRel.FINDFIRST THEN
Contact.GET(ContBusRel."Contact No.");
Contact.SETRECFILTER;
// 3. Copy Filters to DestRecRef
DestRecRef.SETVIEW(Contact.GETVIEW);
Source code of custom table relation between customer and his corresponding contact

You can lookup the source code shown above in the ACF Events Sales & Marketing, function CTR_CUSTOMER:CONTACT.

Creating a custom table relation is done according to the same scheme:

  • Convert record reference into a record; create a local variable and assign it (line 6).
  • Create the destination table as a local variable. The destination table has the type of the destination Anveo Page (in the example table Contact).
  • Transfer the filter to the record reference (line 17)

To use the custom table relation in the Anveo Web Portal a call to function CustomAnveoPageRelation is needed, using the relation code CTR_CUSTOMER:CONTACT:

CASE RelationCode OF
'CUSTOMER:CONTACT': "CTR_CUSTOMER:CONTACT"();
END;

The relation code CUSTOMER:CONTACT needs to be made public in the setup of the Anveo Client Suite and to be entered in the Anveo Page as individual table relation, so that the Anveo Client Suite uses the manually defined table relation instead of globally defined automatic table relations. The record used for filtering at Anveo Pages of type card is defined by the record displayed on the card; in Anveo Pages of type list the record for filtering is defined by the selected record.