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),
Problem with statistic and COUNT
Re: Problem with statistic and COUNT
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),
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),
Tom - V8.8 build 3137 - MySql / PostGres
Re: Problem with statistic and COUNT
https://www.awareim.com/forum/viewtopic ... t=+Context
A good read for process interaction.
https://www.awareim.com/forum/viewtopic.php?f=1&t=9991
A good read for process interaction.
https://www.awareim.com/forum/viewtopic.php?f=1&t=9991
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
-
- Posts: 7525
- Joined: Sun Apr 24, 2005 12:36 am
- Contact:
Re: Problem with statistic and COUNT
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
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
Aware IM Support Team
Re: Problem with statistic and COUNT
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.
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.
Re: Problem with statistic and COUNT
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.
I think if you would have had "IN BATCHES OF 1" on your original FIND, it would have worked.
- Attachments
-
- Create FOR EACH.png (10.5 KiB) Viewed 6866 times
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL