on 2022 Jan 19 5:03 PM
Good day everyone. I'm trying to use a formula to subtract business days. I found a very useful formula from Ken Hamaday below. However I would like to replace the NumberVar Add := -3 with a formula. Essentially I'm trying to back date to a certain process stage in my route for scheduling purposes. The formula would look similar to the following:
IF {Process.Group} = "FINISHING" THEN SUM({Process.Lead_Days}) ELSE 0
I have also thought of using subtotals and running totals but crystal doesn't like those included in formulas.
//Subtracting Business Days:
WhileReadingRecords;
DateVar Array Holidays;
DateVar Target:= date ({ORDE_Goods.Agreed_Date}); //Put your field name in here
NumberVar Add:= -3; // Put in the number of days to subtract (a negative number)
NumberVar Added := 0;
WHILE Added > Add
Do (target := target -1;
if dayofweek (target) in 2 to 6 and not (target in holidays)
then Added:=Added-1
else Added:=Added);
Target
Thank you in advance,
Matt
User | Count |
---|---|
67 | |
11 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.