Hi together,
I would like to know how I can filter an object attribute with AQL and use in the filter the value of another object attribute?
I have the following object types:
Schema: Employee
---------------------
Object Type: Employee
- Name (Label)
- Company (Reference to Company Object)
- Location (Reference to Location Object)
Schema: Company
--------------------
Object Type: Company
- Name (Label)
- Locations (Reference to Location, Cardinality 0 to unlimited)
Object Type: Location
- Company Name
- Address
** Has Inbound Reference of Company (see above)
There are of course several companies with even more locations. By the way, the object type Employee is subdivided into Internal and External Employees, but this is not important for the use case.
I would like to achieve that the selection of the location in the object Type: Employee is filtered based on the attribute Company.
I can set the AQL filter for the attributes.
The following static AQL filter works: 'object having inR(Name LIKE "Example Company")'.
--> As expected, this filter returns only the location objects that have an inbound reference where the name is like "Example Company".
However, I want to filter based on the Company object that is entered in the Employee object (bonus point: if no location is selectable when Company is not selected). This way I would have a dynamic filter.
I have already tried multiple variations:
Examples:
object having inR(Name LIKE ${Company})
object having inR(Name LIKE ${Company})
object having inR(Name LIKE ${Company.Name})
I am currently out of ideas and am curious if there is a solution for this or if this is not possible at all.
PS:
Also happy to suggest alternative ways I can achieve this. Sometimes you can't see the forest for the trees.