The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

AQL query to count laptops with specific status and model

Grega Repar
June 20, 2023

Hi all,

I am wondering how to construct a AQL query to count all laptops of dedicated model by the status "on stock".

Rgds,

Gregor

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Mikael Sandberg
Community Champion
June 20, 2023

Something like this should do it for you:

"Status" IN ("On stock") AND "Model" IN ("13-inch Mac")

Grega Repar
June 21, 2023

Great Mikael,

It works well. Could I somehow count number of those matching this condition and based on a number (eg. < 10 ) trigger a ticket in JIRA - "Low stock (<10) of 13-inch Mac, purchase more"?

What would be the query to count them?

Many thanks in advance!

BR, Gregor

Mikael Sandberg
Community Champion
June 21, 2023

The only way to get the count would be to use an automation to get the size returned from an object lookup. You could make the rule a scheduled one and if the returned size is < 10 send a notification.

Grega Repar
June 21, 2023

This is exactly what I need - in the automation part of Assets I would like to schedule an automation to create a ticket when the condition is True. The condition is: when the number of Laptops with the Status = "Availalble" is < 10 (less than 10).

Is there any list of builtin functions (total, count, sum, size, ....), the syntax and any kind of example of usage?

Mikael Sandberg
Community Champion
June 21, 2023

Hmm, I don't know if the automation in Assets can do it, but I do know that Automation can do it. You can find automation under Project settings in your project (assuming that you are on the latest version of JSM). 

TAGS
AUG Leaders

Atlassian Community Events