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

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). 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events