cancel
Showing results for 
Search instead for 
Did you mean: 

summarizing a running field.

Former Member
0 Kudos

Hi guys. Please help. Im creating a report and i do have this formula

@proc_days

WhilePrintingRecords;

DateVar Array Holidays;

Local DatetimeVar Start := {@Adjusted Item Create Timestamp};

Local DatetimeVar End := {@zzLast Edit Date};

local numbervar days;

Local NumberVar i;

For i := 1 to Count(Holidays) do

(

    if DayOfWeek (Holidays[i]) in 2 to 7 and Holidays[i] in [Start to End] then

         days := days + 1;

);

Datediff("d", Start, End) - Datediff("ww", Start, End, crSunday) - days;

ir computes days of processing of orders excluding the holidays and sundays.

the problem is how can i summarize this @proc_days?

I want to total the orders with 0-3days processing , 4-7days, and 7-15 days.

i tried using running fields but @proc_days dont have on the field list.

my idea is to create a formula like this

            if  {STORER.SUSR2} = 'FSS' then

                 (if {@proc_days2}<=3 then 1)

               else 0

where @proc_days2 code is:

if{@proc days}>0 then

    {@proc days} else

0

the formula is showing orders with 3days and below processing.

i just need to summarize all of those for my report to be finish.

-karlo

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Karlo,

Please see if this works:

1) Create a formula (@proc_days3) with this code:

whileprintingrecords;

numbervar count_3;

if {STORER.SUSR2} = 'FSS' AND ({@proc_days} IN [1 to 3])

   then count_3 := count_3 + 1;


2) Create a formula (@proc_days7) with this code:


whileprintingrecords;

numbervar count_7;

if {STORER.SUSR2} = 'FSS' AND ({@proc_days} IN [4 to 7])

   then count_7 := count_7 + 1;


3) Create a formula (@proc_days15) with this code:

whileprintingrecords;

numbervar count_15;

if {STORER.SUSR2} = 'FSS' AND ({@proc_days} IN [8 to 15])

   then count_15 := count_15 + 1;


Place all these formulae on the same section as the @Proc_days formula


4) Create one last formula on the Report Footer with this code:


whileprintingrecords;

numbervar count_3;

numbervar count_7;

numbervar count_15;


"Total Orders in 0 - 3 days :"&count_3;

"Total Orders in 4 - 7 days :"&count_7;

"Total Orders in 8 - 15 days :"&count_15;


Right-click this field > format field > common tab > check the 'Can Grow' option


-Abhilash

Former Member
0 Kudos

Hi Sir Kumar, your formula works. thanks

but i have a problem. your formula sum up all the values that is true to the formula.

heres the sample

order#               days processed                days_proc 3                    days_proc7          day_proc15

# 1                              1                                        1                                   0                              0

# 1                               1                                       1                                   0                              0

# 2                                   7                                   0                                   1                               0

so days_proc 3 count is 2.

since #1 is just duplicated order #, can we do it 1 only for days_proc3?

i placed order#,days_processed,days_proc3, days_proc7 days_proc15 in details section

and placed  @total_days at the report footer with your code

whileprintingrecords;

numbervar count_3;

numbervar count_7;

numbervar count_15;


"Total Orders in 0 - 3 days :"&count_3;

"Total Orders in 4 - 7 days :"&count_7;

"Total Orders in 8 - 15 days :"&count_15;


thanks for always helping sir.



-karlo

abhilash_kumar
Active Contributor
0 Kudos

You can workaround this by creating a group on the 'Order #' field and moving all the fields and formulae from the Details section to the Group Header/Footer.

-Abhilash

Former Member
0 Kudos

thanks sir. just changed the proc_days to proc_days2. and all is working fine. thanks again sir..^__^

Answers (0)