Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Footer showin top Vaule 1

Status
Not open for further replies.

mezcalbean

Technical User
Oct 4, 2019
13
AU
Hi, I am trying to show four locations running late or on time. in detail, I am evaluating the time

if ({Location} = '1' and {#RTotal0} = 2 and {@Time Vs APP} <= -9 and {@Time Vs APP} <= -29) then 'Running a little behind ' else
if ({Location} = '1' and {#RTotal0} = 2 and {@Time Vs APP} <= -30 ) then 'Running Behind ' else
if ({Location} = '1' and {#RTotal0} = 2 and {@Time Vs APP} <= -45 ) then 'Please Check with Staff ' else 'On Time'

I have placed 4 separate formulas evaluating each location, in the evaluation I'm only looking at a running total id of 2

{#RTotal0} = 2

The idea is to show in the report footer what the running total of id 2 is but I'm only getting the result of id 1 as its first any ideas how to the status of {#RTotal0} = 2 only?
Thanks

SAP_Crystal_Reports_-_Queue__2021-08-16_13-06-54_zxpt2u.jpg
Formula_Workshop_-_Formula_Editor_-_JARRAH_2021-08-16_13-08-40_mhlthf.jpg
 
To answer your 2nd question first, absolutely. I learned a great deal from this forum in the early days of my Crystal career, so am always happy to help where I can. The other reason I do it is I am semi-retired and it helps me keep my skills up and to exercise the brain.

In regards to your formula above, it would only return 'is on time' when the result of {@Time Vs APP} for the 2nd appointment/record is 0 minutes or more, ie ahead of time. Is it not working under those conditions?
 
With the below image for example Tuart only has one person and nothing in the report footer
SAP_Crystal_Reports_-_Queue11_zkvwca.jpg



Fantastic, I will wait for your last bit of help so we can have one conversation going :)
"To answer your 2nd question first, absolutely. I learned a great deal from this forum in the early days of my Crystal career, so am always happy to help where I can. The other reason I do it is I am semi-retired and it helps me keep my skills up and to exercise the brain."

Regards

Philippe
 
Ok, I think I now understand what you are saying (apologies if I am being a bit dumb).

Amend {@Timing} as follows (please note I have used the version from the latest version of the report that you provided as the basis for my amendments):

[Code {@Timing}]
WhilePrintingRecords;
Global StringVar A ;
Global StringVar B ;
Global StringVar J ;
Global StringVar T ;
Global StringVar Z ;

If GroupName ({vw_QueBro.SchLocation}) = 'ACACIA'
Then If {#Acacia} = 2
Then If {@Time Vs APP} <= -9
Then A := 'is running a little behind '
Else
If {@Time Vs APP} <= -30
Then A := 'is running behind '
Else
If {@Time Vs APP} <= -45
Then A := 'Please Check with Staff '
Else A := 'is on time'
Else
If {#Acacia} = 1
Then A := 'is on time '
Else A := A;

If GroupName ({vw_QueBro.SchLocation}) = 'BANKSIA'
Then If {#Banksia} = 2
Then If {@Time Vs APP} <= -15
Then B := 'is running a little behind '
Else
If {@Time Vs APP} <= -30
Then B := 'is running behind '
Else
If {@Time Vs APP} <= -45
Then B := 'Please Check with Staff '
Else B := 'is on time'
Else
If {#Banksia} = 1
Then B := 'is on time '
Else B := B;

If GroupName ({vw_QueBro.SchLocation}) = 'JARRAH'
Then If {#JARRAH} = 2
Then If {@Time Vs APP} <= -15
Then J := 'is running a little behind '
Else
If {@Time Vs APP} <= -30
Then J := 'is running behind '
Else
If {@Time Vs APP} <= -45
Then J := 'Please Check with Staff '
Else J := 'is on time'
Else
If {#JARRAH} = 1
Then J := 'is on time '
Else J := J;

If GroupName ({vw_QueBro.SchLocation}) = 'TUART'
Then If {#TUART} = 2
Then If {@Time Vs APP} <= -4
Then T := 'is running a little behind '
Else
If {@Time Vs APP} <= -30
Then T := 'is running behind '
Else
If {@Time Vs APP} <= -45
Then T := 'Please Check with Staff '
Else T := 'is on time'
Else
If {#TUART} = 1
Then T := 'is on time '
Else T := T;

''
[/Code]

I have added an additional line in the code for each location to deal with the situation where there is only 1 person waiting.

I think that should now resolve the final outstanding issue.

Regards
Pete
 
Thank you Pete perfect all weel very well now, I had no idea it was going to be this involved.

In regards to your writing and trying to pick out things I don't understand can I ask the first question or point me in the direction about "WhilePrintingRecords;" I have not used this of as yet and how to truly implement it within a report?

Thank you
 
Hi Philippe

"WhilePrintingRecords" is an Evaluation Time function that tells Crystal when to evaluate the formula. In this case it effectively forces Crystal to wait until all records have been read into memory, grouped and sorted before it evaluates.

I always use it whenever I use variables, although to be honest I have never tested it to see what would happen if omitted.

The other Evaluation Time options are "BeforeReadingRecords", "WhileReadingRecords", "WhilePrintingRecords" and "EvaluateAfter". Have a look at the Crystal Help files on these if you are interested.

The other alternative I have used more than once or twice is "EvaluateAfter", which is useful when you have a formula that refers to another formula that sits in the same report section, and where you need to control the order that the formulas execute in.

Definitely something to be aware of, and it is generally recommended that you use "WhilePrintingRecords" when using variables.

Hope this helps.

Cheers,
Pete
 
Hi Pete, thank you again for your help and the information you have provided - I have saved all this information and hopefully I will revert to this page, also hopefully helped out someone else as well :)

Regards

Philippe

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top