Skip to Content
0
Former Member
Jul 29, 2014 at 09:11 AM

How to implement a BRF+ table with unique key?

269 Views

How can I implement a table with a unique key property in BRF+ or make a table compliant to some unique key constraint?

Use case:

  • I have to execute some expression only once per data entity (identified by a name)
  • Which of these expressions to execute depends on the input data
  • Number of expressions is much greater than data entities
  • Final step: For each unique data entity (name) that had expressions executed, do a data store operation

Normally I would use a HASHED or SORTED TABLE WITH UNIQUE KEY name for this, but BRF+ tables are STANDARD TABLE internally, even when bound to a DDIC table.

Right now I and INSERT only if not.

Since I do not need the table during the intermediate steps, an easier approach could be to SORT the table and then DELETE ADJACENT DUPLICATES. Table operations can sort, but the Table Operations expression does not seem to offer the duplicate deletions.