Tech Tip: Utility Method to Find Relation Name Between Two Tables
PRODUCT: 4D | VERSION: 19 R4 | PLATFORM: Mac & Win
Published On: March 21, 2022
Below is a utility method that will return the name of the relation from the table passed as the first parameter to the table passed as the second parameter.
//Util_getRelationName #DECLARE($srcTable_t; $dstTable_t : Text)-> $relationName_t : Text For each ($relationName_t; ds[$srcTable_t]) If (String(ds[$srcTable_t][$relationName_t].relatedDataClass)=$dstTable_t) return($relationName_t) End if End for each return("") |
With ORDA, the names of the relations can be used to return related entity selections. However, this does increase the need to remember more names and is made even more difficult with the need case sensitivity of ORDA. This method can be used to assist with returning the proper name of the relation to the desired table.