Idea ID: 1672392

Business Rule for a lookup

Status : Delivered
over 2 years ago

Hello, we would like to get the possibility to do a lookup between 2 tables in the business rules. (for exemple : entity.id == entity.table2.id)

Tags:

  • Hi,

    Thanks. This encourages me to keep submitting new ideas

    Regards, Darek 

  • This idea has been implemented in product release SMAX 2020.08. Check out the release notes for details. Thanks to all of our contributors for helping us continue to improve our products!

  • I think the best way to approach this would be to provide a function like the ones in the expression language, for example:

    lookup(entity, filter_condition) or lookup(entity, attribute1, attribute1_value, attribute2, attribute2_value,...)

    This would query the given table with the given condition and return the collection of results. For example, I could query for the devices of the subtype 'Desktop': lookup('Device','subtype == ''Desktop''') or lookup('Device','subtype','Desktop')

    It would also be nice to provide a function to count the returned number of records inside the collection and a way to get the first item, or the Nth item (a sort filter would come handy here) and be able to access fields of the item like this:

    lookup(entity, filter_condition)[0].field1

    Or by functions, like it is done with the comments:

    get_nth_item_in_collection(lookup(entity, filter_condition), 0).field1

    get_field(get_nth_item_in_collection(lookup(entity, filter_condition), 0))

  • It will be very useful and such feature should present in any programming environment.