Resetting a Weekly Total. R&R 8.1 dBase
-
- Posts: 2
- Joined: Tue Oct 10, 2017 12:44 pm
Resetting a Weekly Total. R&R 8.1 dBase
This is the situation:__problem 1:__Each record I^m reporting has a date field with multiple records per day, and I need a total field that will reset at the end of each week. Since I can have multiple records per day, I cannot have the total reset based on Day Of Week... because it^s Saturday, it doesn^t necessarily mean that it^s the last record on Saturday.__I have tried to determine the end of the week by looking at the DOW of the previous record using PREVIOUS(), but anything calling previous cannot be used to reset a running total. How can I determine if the current record is the last record of the last day of the current week?!? There has to be a way to do it, but the solution is evading me.____problem 2:__On this weekly total, my client wants detail to be shown on a per-record basis, but only wants the total to be shown on the last record on the last day of the current week. My requirements call for the total to *NOT* be on a separate line - and to *ONLY* be shown just before the total is reset (next record is the beginning of a new week).____Any help please??____Ben Shaffer__techhelp@tracyinc.com
=> RE: Resetting a Weekly Total. R&R 8.1 dBase
>This is the situation: __>problem 1: __>Each record I^m reporting has a __>date field with multiple records __>per day, and I need __>a total field that will __>reset at the end of __>each week. Since I __>can have multiple records per __>day, I cannot have the __>total reset based on Day __>Of Week... because it^s Saturday, __>it doesn^t necessarily mean that __>it^s the last record on __>Saturday. __>I have tried to determine the __>end of the week by __>looking at the DOW of __>the previous record using PREVIOUS(), __>but anything calling previous cannot __>be used to reset a __>running total. How can __>I determine if the current __>record is the last record __>of the last day of __>the current week?!? There __>has to be a way __>to do it, but the __>solution is evading me. __>__>problem 2: __>On this weekly total, my client __>wants detail to be shown __>on a per-record basis, but __>only wants the total to __>be shown on the last __>record on the last day __>of the current week. __>My requirements call for the __>total to *NOT* be on __>a separate line - and __>to *ONLY* be shown just __>before the total is reset __>(next record is the beginning __>of a new week). __>__>Any help please?? __>__>Ben Shaffer __>techhelp@tracyinc.com ______The WK_OF_YEAR function from the RR.UDF that can be found in the technotes section of our website will solve problem 1.____Once you have the week grouping working, to solve the second problem, you need to create two more total fields. CNT1 will be a count of a field that changes for each record and will reset when the week changes. CNT1 will be exactly the same as CNT1 except you will click the options button to make it pre-processed.__Then create a calculated field with the expression:__IIF(CNT1=CNT2,WEEKTOT,BLANKNUM())__Then place this calculated field on the record bank.__The weekly total WEEKTOT will only print for the last record for the week.____I hope that this helps.____Kathleen__