Calculate number of rows in report (1 Viewer)

theDBguy

I’m here to help
Staff member
Local time
Today, 12:58
Joined
Oct 29, 2018
Messages
21,358
theDBguy and isladogs,
Thank you very much,

It works and I can use this field for further calculations of Ratio what I wanted.

But, culd you explain it to me where =[number_rows] came from?
Hi. Glad we could assist. As I hinted earlier, you sometimes have to add "hidden" controls to do intermediate calculations for used in your final calculations. The reason why my first image didn't work was because when the report is rendered, the group header control can only grab the first row of the detail section. If you'll notice in my second image, when I placed that control in the group footer section, it was able to wait until all the rows in the detail section were processed before it displays the last value. Since you wanted to display this information in the group header, though, I had to hide the one in the footer and add a new one in the group header pointing to the one in the group footer. This is what you have to do sometimes with reports. Hope that makes sense...
 

lbs

Registered User.
Local time
Today, 19:58
Joined
Dec 22, 2019
Messages
109
theDBguy,
I can't find it in the group footer. How did you hide it? I just wanted to remember how it looks like for use in the future.
 

lbs

Registered User.
Local time
Today, 19:58
Joined
Dec 22, 2019
Messages
109
Sorry theDBguy I found it, You've just collapsed it completely

Now I see what is the trick

Many thanks for your help

lbs
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:58
Joined
Oct 29, 2018
Messages
21,358
Sorry theDBguy I found it, You've just collapsed it completely

Now I see what is the trick

Many thanks for your help

lbs
Oh yeah, sorry about that. I did forget to mention how to find it. Glad to hear you managed though. Cheers!
 

lbs

Registered User.
Local time
Today, 19:58
Joined
Dec 22, 2019
Messages
109
Hope that makes sense...

I am very sorry to be such a pain tonight. But there is another problem.
When I open report, my calculated field Ratio displays correctly. But when I open Report Preview, the calculations go wrong and the field is showing incorrect values. What's going on?
I attached db . r_10_mdt_cons_01
 

Attachments

  • Rota.zip
    220.8 KB · Views: 103

theDBguy

I’m here to help
Staff member
Local time
Today, 12:58
Joined
Oct 29, 2018
Messages
21,358
I am very sorry to be such a pain tonight. But there is another problem.
When I open report, my calculated field Ratio displays correctly. But when I open Report Preview, the calculations go wrong and the field is showing incorrect values. What's going on?
I attached db . r_10_mdt_cons_01

Hi. I just left my computer, so I'll take a look later, okay?

Sent from phone...
 
Last edited:

Gasman

Enthusiastic Amateur
Local time
Today, 19:58
Joined
Sep 21, 2011
Messages
14,047
I am very sorry to be such a pain tonight. But there is another problem.
When I open report, my calculated field Ratio displays correctly. But when I open Report Preview, the calculations go wrong and the field is showing incorrect values. What's going on?
I attached db . r_10_mdt_cons_01

PMJI, and I might have got the wrong end of the stick, but the preview looks correct to me (*as I understood) it and the report view which is awry.?

View


Preview
 

Attachments

  • report view.PNG
    report view.PNG
    9.6 KB · Views: 185
  • report preview.PNG
    report preview.PNG
    11.7 KB · Views: 176

lbs

Registered User.
Local time
Today, 19:58
Joined
Dec 22, 2019
Messages
109
PMJI, and I might have got the wrong end of the stick, but the preview looks correct to me (*as I understood) it and the report view which is awry.?


No Gasman, the report view is correct and print preview is incorrect. I want to calculate a so called ratio. That is when all consultants do equal number of MDTs then their ratio is 1. If someone does more then the ratio is up. But it is not the proportion of MDTs. Some of our consultants work part time and I need to monitor that their ratio should be for example 0.7.
 

Gasman

Enthusiastic Amateur
Local time
Today, 19:58
Joined
Sep 21, 2011
Messages
14,047
Ok,
I've discovered that in print preview mode the num_rows is always 1 ?
You can see that as the report appears immediately, no delay with a calculation.
If you use layout view that does give you the same as Report view.

I have no idea as to why this happens in print preview, but I need to remember this in case I need to do likelwise calcs.

Reveal the group footer and the num_rows control and you will see what I mean.

HTH
 

lbs

Registered User.
Local time
Today, 19:58
Joined
Dec 22, 2019
Messages
109
Ok,
I've discovered that in print preview mode the num_rows is always 1 ?
You can see that as the report appears immediately, no delay with a calculation.
If you use layout view that does give you the same as Report view.

I have no idea as to why this happens in print preview, but I need to remember this in case I need to do likelwise calcs.

Reveal the group footer and the num_rows control and you will see what I mean.

HTH

I've done something now. I created another query as a data source of report where some calculations are already done. Now the new report looks fin in both modes.

Thanks for looking into it
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:58
Joined
Oct 29, 2018
Messages
21,358
I've done something now. I created another query as a data source of report where some calculations are already done. Now the new report looks fin in both modes.

Thanks for looking into it

Hi. Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom