Hello Family,
I have two time zones in repeat mode, as shown below:
preproc
S3Q1(01)="ACTIVITY1:04:00 to 05:00";
S3Q1(02)="ACTIVITY2:04:00 to 05:00";
S3Q1(03)="ACTIVITY3:04:00 to 05:00";
S3Q1(04)="ACTIVITY4:04:00 to 05:00";
S3Q1(05)="ACTIVITY5:04:00 to 05:00";
S3Q1(06)="ACTIVITY1:05:00 to 06:00";
S3Q1(07)="ACTIVITY2:05:00 to 06:00";
S3Q1(08)="ACTIVITY3:05:00 to 06:00";
S3Q1(09)="ACTIVITY4:05:00 to 06:00";
S3Q1(10)="ACTIVITY5:05:00 to 06:00";
I am collecting data about the total number of minutes for the activities within the time zone 04:00 to 05:00. I want to run a check so that when you sum the total number of minutes reported for the five activities under the time zone 04:00 to 05:00, the total must equal 1 hour (60 minutes). If it is not equal to 60 minutes, it should generate an error.
I have created a total time variable for zone 1 to hold the calculation by summing the minutes for the activities within the zone. However, the calculation did not work. Here's the code I tried:
preproc
TZ1= ACTUAL_MINUTE(1) + ACTUAL_MINUTE(2)+ACTUAL_MINUTE(3) ACTUAL_MINUTE(4)+ACTUAL_MINUTE(5)
I need your help to complete this task. I have attached a sample of the dictionary for better understanding.
How to Sum Within a partcular Occurance(eg 1:5)
How to Sum Within a partcular Occurance(eg 1:5)
- Attachments
-
- FOR_SUPPORT.zip
- (391.05 KiB) Downloaded 1368 times
-
- Posts: 58
- Joined: October 15th, 2020, 3:40 am
Re: How to Sum Within a partcular Occurance(eg 1:5)
Hi sham
You forget to add the + sign in your logic after ACTUAL_MINUTE(3). You can add the total time using your own logic.
preproc
$= ACTUAL_MINUTE(1) + ACTUAL_MINUTE(2)+ACTUAL_MINUTE(3) ACTUAL_MINUTE(4)+ACTUAL_MINUTE(5);
alternately you can use this logic too;
numeric TZ1_total;
TZ1_total = sum(ACTUAL_MINUTE);
$ = TZ1_total;
postproc
if $ > 60 then
errmsg("........................"); reenter S3Q3I(1); endif;
Thank you.
You forget to add the + sign in your logic after ACTUAL_MINUTE(3). You can add the total time using your own logic.
preproc
$= ACTUAL_MINUTE(1) + ACTUAL_MINUTE(2)+ACTUAL_MINUTE(3) ACTUAL_MINUTE(4)+ACTUAL_MINUTE(5);
alternately you can use this logic too;
numeric TZ1_total;
TZ1_total = sum(ACTUAL_MINUTE);
$ = TZ1_total;
postproc
if $ > 60 then
errmsg("........................"); reenter S3Q3I(1); endif;
Thank you.
Re: How to Sum Within a partcular Occurance(eg 1:5)
Hi Arjun,
Thank you so much for the support.
Thank you so much for the support.