Solved

Determine which table variant is used

  • 13 May 2020
  • 2 replies
  • 122 views

Badge

We have the situation that in a form you can choose a subselection of accounts.
An account can belong to multiple groups like shipper, transporter, agent
In the form we have a column with a lookup table variant, so that we only have a slection of accounts belonging to for example shipper group.
Everything works ok.


Now if we go to the selection detail form (clicking the magnifier glass) it will be easier for the person who are filling in the form to add a new shipper from there.


However after adding the account, the account is not visible in the form anymore, because there is no connection with the account group 'shipper'
Is it possible to detect which table variant you are using so that after inserting the new account, also a new entry is inserted in the table account group?

 

icon

Best answer by Anne Buit 13 May 2020, 16:30

View original

2 replies

Badge

Thank you for the info. Actually the view with trigger option I was already thinking about in case there was no other/better way.

Userlevel 7
Badge +5

Hi Stefan,

There are a couple of ways to achieve this.

You can use a view that also adds the group in the instead-of-insert trigger. This view can then be used as look-up instead of the table. The prefilter would no longer be required as the view could filter on accounts in the ‘Shipper’ group.

Alternatively, you can change the look-up to a variant and add a process flow that automatically adds the group after adding a record. The process flow can be configured to exclusively start on the variant used in the look-up. However, you'd have to refresh and navigate back to the record because it would not show up for a short window of time.

Last and least - You can change the look-up to a variant and modify a default value of one of the columns, indicating the fact that is has been added in this specific variant. An after-insert trigger can then automatically create the Shipper group record. A bit hacky as it requires a column for the sole purpose of directing this logic.

The view is the most clean way to go about this. Adding a record to this view is not the same as adding a record on the base table from a functional perspective, allowing different rights and roles for this view. It opens up functionality such as only removing the account from the Shipper group when a user uses the delete functionality in this view as well.

Reply