Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

AQL filter in Assets

Marcelo Montaño Sánchez
Contributor
July 28, 2023

Hi everyone!

I have 3 types of Assets objects:

Object1. Labels:
E1, E2, E3, E4, E5, E6, E7, E8, E9, E10

Object2. Group, with an attribute of type Labels:
Group A -> E1, E2, E3
Group B -> E4, E5, E6

Object3. User, with an attribute of type Groups (multivalue) and an attribute of type Labels (multivalue):
User 1:

  • Groups: Group A, Group B.
  • Labels:   E1, E2, E3, E4, E5, E6, E7, E8, E9, E10

When I create a new User object, the labels field should list ONLY the labels that are associated with the selected groups, that is, if the user selects Group A, only the labels E1, E2, and E3 should be listed. If the user also selects Group B, the labels should be only E1...E6.

The AQL that I use in the Labels attribute of the User object does not get anything and the system generates an error, how can I filter the labels?

 

Regards

1 answer

0 votes
Björn Gullander Eficode
Community Champion
July 31, 2023

Hi,

You should be able to use the following AQL in the "Filter objects AQL" setting of the Labels Attribute. 

object HAVING inboundReferences(Name IN (${Groups}))

Best way to get the correct AQL is to go to the Labels object type and write the correct AQL using a fixed Group Name. For example object HAVING inboundReferences(Name IN ("Group A")). Then exchange the fixed Name with a placeholder ${Groups}

Marcelo Montaño Sánchez
Contributor
July 31, 2023

Hi, thanks for the answer.

Indeed I am using that AQL, I forgot to indicate it in the question.
That AQL works when I select a single Group, if I select two groups, the query doesn't work

.

Björn Gullander Eficode
Community Champion
August 1, 2023

You're right - this is apparantly a bug. I made a bug report to Atlassian on this - let's see if they solve it anytime soon. 

Björn Gullander Eficode
Community Champion
August 1, 2023

New improved answer :)

Placeholders for multiple objects are not really intuitive to understand (and you don't get any syntax help either)

This AQL should work: 

object HAVING inboundReferences(Name IN (${LabelGroups${0}}))

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events