Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to filter asset object attribute with AQL, to show subset of reference?

Frederic Wolf April 8, 2023

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.

1 answer

1 vote
Suzi Firth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 11, 2023

Hi @Frederic Wolf 

I think I understand what you are trying to achieve here as it sounds similar to something I have done that I have done with my Asset Types and Models.

So basically, you have:

Company A at Locations 1 2 and 3

Company B at Locations 1 3 and 4

Meaning some locations are exclusively Company A or B but some locations have employees from both Company A and B.

So being similar to how I have setup my Schemas, I would have a Company Object Type and each asset would be a Company Name.

I would then have a Locations Object Type and each Asset would be a Location Name. There would be an attribute on this, that links to Company Object Type. The cardinality could be multiple as Location 1 may be relative to Company A and B but Location 2 only for Company A.

Then over on my Employee or Asset Object Type I would have Attributes for Company and Location. Each linking to the relevant Schema and Object Type. Company would be a direct link to Company Schema. Location would be a direct link to Location schema however on the AQL Filter it would say Company = ${Company}.

This means that as you are filling in the Asset, you select Company attribute first in current schema. And then when you click the Location drop down, the list will only show Locations based on the Company you selected just prior to it. If no company is selected, then no locations will show.

 

I have done this same thing in my system with Asset Types and Models.

As an example: I have no Type Selected so my Model drop down shows No Options

Capture1.JPG

When I select Type as HDW-Laptop, now you can see my Model drop down is Filtered to All Models with a Type as a Laptop (sorry my screenshot is weird. The drop down actually drops up, not down)

Capture2.JPG

 

This is the Asset View showing all models with type HDW-Laptop:

Capture3.JPG

Kind Regards,

Suzi

Frederic Wolf April 12, 2023

Hi @Suzi Firth ,

i just read over your post and have no access to my laptop. 

So to clear things up, location is something like „headquarter berlin“, „warehouse hannover“ and so on. 

each company has multiple locations. Each location has one company.

as far i can see you flipped the logic around. So your location has the conpany reference attribute. I think i can do it at my schema, too. 

What I don't really understand is that you also use a variable and it works for you. I do in principle the same, only that I use the inbound reference.

I will try it out and am curious if it works.

Like Suzi Firth likes this
Suzi Firth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 12, 2023

Hi @Frederic Wolf 

Yes I used Location with the Company Reference. You can of course flip this around and use Company with Location Reference so you would select the location first and then have the Company list filter to only Companies associated with that location too.

I just explained it in terms of what option I thought you were most likely to select first.

Looking forward to hearing how this goes for you.

Like Frederic Wolf likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events