Sum of integer Advanced Search results.

joshuasee
Contributor III

I've created an extension attribute to list the number of USB printers a computer has, returning an integer. I can create a Smart Group or Advanced Search based on the results, but is there any way to return a sum of printers as the result rather than a count of computers with USB printers?

1 ACCEPTED SOLUTION

davidacland
Honored Contributor II
Honored Contributor II

Not sure if I'm completely getting the question so I'll give it a go...

If you mean showing the total number of printers across a group of computers, i.e:

  • computer 1 - 2 printers
  • computer 2 - 1 printer
  • computer 3 - 4 printers
  • Total - 7 printers

The short / easy answer is no. This is because the group wouldn't have anywhere to store or show the total value.

That being said, you can read the extension attributes and their values using the API (see the /computers section of https://yourjss.com:8443/api. With a looping script you could read the value from each matching record and then add them up to get the total.

Not an easy task but certainly possible.

View solution in original post

1 REPLY 1

davidacland
Honored Contributor II
Honored Contributor II

Not sure if I'm completely getting the question so I'll give it a go...

If you mean showing the total number of printers across a group of computers, i.e:

  • computer 1 - 2 printers
  • computer 2 - 1 printer
  • computer 3 - 4 printers
  • Total - 7 printers

The short / easy answer is no. This is because the group wouldn't have anywhere to store or show the total value.

That being said, you can read the extension attributes and their values using the API (see the /computers section of https://yourjss.com:8443/api. With a looping script you could read the value from each matching record and then add them up to get the total.

Not an easy task but certainly possible.