If you have questions or if you want to share your opinion about Aware IM post your message on this forum
#51720 by Rem
Thu Oct 03, 2019 10:05 am
We are struggling to get some statics to work the way we want them to.. (sorry if this is a stupid question but we have tried searching for relevant examples the entire day now ..)

We are running a process that collects installation and service jobs from a system and we are trying to COUNT it by user and save it to a statistic BO.

We have managed to get all the users out from the system and it show one row per user as we want it to do. But we cannot get the count right. It seems as it counts the first users jobs and put it on every user. If we change the sorting it will give us another number but always the same in every row.

It’s the two COUNT rows that we have problem with.

Any help is much appreciated!

The process look like this:

FIND RegularUser WHERE (RegularUser.LoginName<>'admin') ORDER BY RegularUser.LoginName DESC


CREATE Bokningsstatistik FOR EACH RegularUser WITH Bokningsstatistik.Tekniker=RegularUser.LoginName,
Bokningsstatistik.Installationer=COUNT Bokningar WHERE (Bokningar.Jobbtyp='Installation' AND Bokningar.Tekniker=RegularUser),
Bokningsstatistik.Service=COUNT Bokningar WHERE (Bokningar.Jobbtyp='Service' AND Bokningar.Tekniker=RegularUser),
#51721 by tford
Thu Oct 03, 2019 12:46 pm
One option is to break it into two processes:

Process_1:
FIND RegularUser WHERE (RegularUser.LoginName<>'admin') ORDER BY RegularUser.LoginName DESC IN BATCHES OF 1
Process_2

Process_2 (uses RegularUser as Input)
CREATE Bokningsstatistik WITH Bokningsstatistik.Tekniker=RegularUser.LoginName,
Bokningsstatistik.Installationer=COUNT Bokningar WHERE (Bokningar.Jobbtyp='Installation' AND Bokningar.Tekniker=RegularUser),
Bokningsstatistik.Service=COUNT Bokningar WHERE (Bokningar.Jobbtyp='Service' AND Bokningar.Tekniker=RegularUser),
#51732 by aware_support
Fri Oct 04, 2019 12:06 am
In theory what you have there is correct and should work. So either there is no problem and the result of COUNT is correct (check your data!) or there is a bug.

If you break it up into two processes as suggested above and it works, then there is a bug in the system and we'll need to know
#52013 by joben
Wed Nov 06, 2019 10:45 pm
Me and Rem are working with the same business space and here is a late reply.

We tried tfords solution of using two processes, and it works exactly the way we wanted. Thanks!

If this is considered a bug we can provide a BSV.
#52034 by Jaymer
Fri Nov 08, 2019 5:23 am
I did this today, and it worked as expected.
I think if you would have had "IN BATCHES OF 1" on your original FIND, it would have worked.
Attachments
Create FOR EACH.png
Create FOR EACH.png (10.5 KiB) Viewed 399 times

Who is online

Users browsing this forum: MSN [Bot] and 30 guests