How to create a sum on change of a detailed record without using groups
Hi,
I'm working on an overtime/payroll report. Overtime hours are calculated based on hours worked greater than 40 within the span of Sunday to Saturday. Further, pay periods are every two weeks and do not align with the calendar week of sunday to saturday.
I've managed to figure out how to do the overtime calculation from sunday to saturday and then the totals for each of these calendar weeks. However, I'd also like to calculate the totals for the pay periods. I cannot group on both the calendar week AND the pay period id because sometimes the calendar week starts before the pay period starts and sometimes the pay period starts before the calendar week. So, one is not a sub-group of the other. I tried setting both up as groups but it, unfortunately, resets by hour calculations at the wrong point because when one group is still going the other is ending.
So, the report is working well with just the one group - calendar week (oh, and there is a higher level group - employee id as this calculation is done for each employee). I can include the pay period id in the detail lines and I can see when it changes. So, if I could create a formula that summed the hours by pay period id and than reset when a new pay period id begins that is what I am after. I just want the sum of hours upon each change of pay period id. I'll attempt to show what the data looks like below:
Group 1: Employee Name (say Fred Jones)
Group 2: Week Beginning January 8, 2012
Date RegularHours OvertimeHours PayPeriodId
Jan 8 12 0 1
Jan 9 12 0 1
Jan 10 12 0 1
Jan 11 4 8 1
Jan 12 0 12 1
Jan 13 0 9 1
Jan 14 0 6 1
Total 40 35
Group 2: Week Beginning January 15, 2012
Date RegularHours OvertimeHours PayPeriodId
Jan 15 12 0 1
Jan 16 12 0 1
Jan 17 12 0 1
Jan 18 4 9 2
Jan 19 0 10 2
Jan 20 0 8 2
Jan 21 0 7 2
Total 40 34
So, the total hours for pay period #1 should be:
RegularHours OvertimeHours
76 35
And, the total hours for pay period #2 should be:
RegularHours OvertimeHours
4 34
I tried creating a formula: Distinctcount ({@OT Hours}, {Command.pay_periods_id}) but Crystal says I cannot summarize the formula that is in it.
I'm not a programmer but it feels like a loop of some sort (For each, unique pay period id sum the OT Hours).
Any and all help much appreciated in advance!
Mark
Edited by: mahewitt on Feb 14, 2012 4:42 AM
Hi Mark,
Here's something I have come up with:
1) Create this formula and place it on the details section beside the PayPeriodID field.Replace in the formula with PayPeriodId, with RegularHours and with OvertimeHours.
WhilePrintingRecords;
numbervar array reg_hrs;
numbervar array ot_hrs;
numbervar array payid;
numbervar reg;
numbervar ot;
numbervar x;
numbervar y;
if not({PayperId} in payid) then
y := y + 1;
redim preserve payid[y];
payid[y] := {PayperId};
if onlastrecord then
reg := reg + {Regular};
ot := ot + {Overtime};
x := x + 1;
redim preserve reg_hrs[x];
redim preserve ot_hrs[x];
reg_hrs[x] := reg;
ot_hrs[x] := ot;
else if {PayperId} = next({PayperId}) then
reg := reg + {Regular};
ot := ot + {Overtime};
else
reg := reg + {Regular};
ot := ot + {Overtime};
x := x + 1;
redim preserve reg_hrs[x];
redim preserve ot_hrs[x];
reg_hrs[x] := reg;
ot_hrs[x] := ot;
reg := 0;
ot := 0;
2) Create this formula and place it on the Group Footer 1 (Employee Name group):
WhilePrintingRecords;
numbervar array payid;
numbervar array reg_hrs;
numbervar array ot_hrs;
numbervar i;
stringvar final;
for i := 1 to ubound(payid) do
final := final + "For Pay Period # "&payid<i>&chr(13)&chr(13)&"Regular Working Hours are :"®_hrs<i>&chr(13)&"Overtime Hours are :"&ot_hrs<i>&chr(13)&chr(13)&chr(13)
final;
3) Right-click this field and select Format Field > Common tab > Check the 'can grow' option and increase the horizontal size of the formula field to around 3.5 to 4'
4) Create this formula to reset the variables at the Group Header 1. This will make sure it prints the Regular and Overtime hours for every employee:
whileprintingrecords;
numbervar array reg_hrs := 0;
numbervar array ot_hrs := 0;
numbervar array payid := 0;
numbervar reg := 0;
numbervar ot := 0;
numbervar x := 0;
numbervar y := 0;
numbervar i := 0;
stringvar final := "";
You may then hide the 1st and the last formula (Right-click > Format field > Common tab > Suppress)
Let me know how this goes!
-Abhilash
Similar Messages
-
How to create a new Oracle OSB project automaticaly with script without IDE
Hello,
I want to create automatically an "Oracle service bus project" and an "Oracle service bus configuration project" with scripts (ANT or Maven or ...) without using IDE, without using workshop or Eclipse. I want to create automatically (ANT or Maven) just a skeleton of an OSB project witch i can use after in workshop.
I want to create 1 "Oracle service bus configuration project" with many "Oracle service bus project" automatically (ANT or Maven or scripts) witch i can use after in workshop. How to create a new Oracle OSB project automaticaly with script without IDE ? How can i do this ?
I'm using Oracle service bus 10.3.1
Thank you for your help.Thank you for your response,
I do not want to just create the services (proxy services and business services) but I want to create a template for 40 OSB project with the same scripts ANT/Maven.
Template="Oracle service bus configuration project" + "Oracle service bus project" + services of 40 OSB projects
The goal is that I have more than 40 projects to create and just the name of the projects that changes (when I say the name of the project ie the name of the OSB project, the name of proxy services and the name of business services ).
So I want to give my script (ANT/Maven) the name of 40 OSB project and the script must generate the skeleton of the 40 projects at once time and after generation of skeleton of the 40 project, I will import them in the workshop to add manually mapping and routing and other things that differs from one project to another.
So i want to generate automatically a skeletons of 40 OSB projects using a script (ANT / Maven) and I give to the script juste the names of the 40 projects.
I want to create a "Oracle service bus configuration project" and "Oracle service bus project" automatically of 40 OSB projects (ANT or Maven or scripts) witch i can use after in workshop.
I want to create one 'template' of all 40 projects in the same time, with the same directory structure (Transforlation, Business services, proxy services, WSDL .....) and all 40 project have the same transport, just the names of projects and services witch changes and i can give to the script all names of projects and services and i can give also all WSDL.
Regards,
Tarik -
How to create i view in visual composer give details screenshots
how to create i view in visual composer give details screenshots
Hi,
Go through these threads
VisualComposer
http://help.sap.com/bp_epv170/EP_US/HTML/Executive_Cockpit.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1752b737-0401-0010-0ba3-87c3eda8c6ce
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e019d290-0201-0010-f186-8630a949800a
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/30987099-a74c-2a10-70b5-a2751ce79359
http://help.sap.com/saphelp_nw04/helpdata/en/fd/4a7e40417c6d1de10000000a1550b0/content.htm
Tarak
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00b9ba6d-1291-2a10-208d-bd27544e7939 -
How to create customer material information(vd51) and what is it's use
how to create customer material information(vd51) and what is it's use.
does it will work even in mm module also??
my requirement is such that...
my sap code is 235
where as customer will give purchaase order on code 536.when i am entering this 536 code in my system,automatically sytem should propse my sap code of 235.subsequently my inventory should reduce.Hi,
the transaction for maintaining the customer material inforecord is VD51.Data on a material defined for one specific customer is stored in the customer material information records.
Features:
During order entry, items can be entered by specifying the material number used by the customer. You also enter a customer material number in the order view of the sales order. You can then use both material numbers during the order entry, the material number your company uses or the one defined by the customer, because the system can carry out allocation automatically.
If you maintain the plant in the customer material info record, the system will give priority for the plant maintained in the CMIR in the order.
Prase -
I have recently immigrated to the US but my apple ID is still stuck with my previous country. How do I change the country? Preferably without using a credit cardI've only been here in the US 2 months and still have no US credit card.
Your credit or debit card credentials must be associated with the same country where you reside.
"Although you can browse the iTunes Store in any country without being signed in, you can only purchase content from the iTunes Store for your own country. This is enforced via the billing address associated with your credit card or other payment method that you use with the iTunes Store, rather than your actual geographic location."
From here > The Complete Guide to Using the iTunes Store | iLounge Article -
How to write a SQL Query without using group by clause
Hi,
Can anyone help me to find out if there is a approach to build a SQL Query without using group by clause.
Please site an example if is it so,
RegardsI hope this example could illuminate danepc on is problem.
CREATE or replace TYPE MY_ARRAY AS TABLE OF INTEGER
CREATE OR REPLACE FUNCTION GET_ARR return my_array
as
arr my_array;
begin
arr := my_array();
for i in 1..10 loop
arr.extend;
arr(i) := i mod 7;
end loop;
return arr;
end;
select column_value
from table(get_arr)
order by column_value;
select column_value,count(*) occurences
from table(get_arr)
group by column_value
order by column_value;And the output should be something like this:
SQL> CREATE or replace TYPE MY_ARRAY AS TABLE OF INTEGER
2 /
Tipo creato.
SQL>
SQL> CREATE OR REPLACE FUNCTION GET_ARR return my_array
2 as
3 arr my_array;
4 begin
5 arr := my_array();
6 for i in 1..10 loop
7 arr.extend;
8 arr(i) := i mod 7;
9 end loop;
10 return arr;
11 end;
12 /
Funzione creata.
SQL>
SQL>
SQL> select column_value
2 from table(get_arr)
3 order by column_value;
COLUMN_VALUE
0
1
1
2
2
3
3
4
5
6
Selezionate 10 righe.
SQL>
SQL> select column_value,count(*) occurences
2 from table(get_arr)
3 group by column_value
4 order by column_value;
COLUMN_VALUE OCCURENCES
0 1
1 2
2 2
3 2
4 1
5 1
6 1
Selezionate 7 righe.
SQL> Bye Alessandro -
How do I transfer music from one iPhone to the other without using a laptop and will I be billed?
Download Past Purchases
http://support.apple.com/kb/HT2519
Or do you mean this...
Old Phone to New Phone
http://support.apple.com/kb/HT2109
Also...
It should be Noted that anything Downloaded with a Particular Apple ID is tied to that Apple ID and Cannot be Merged or Transferred to a Different Apple ID -
How can I install Snow Leopard on my 15" MacBook Pro without using its DVD drive?
How can I install Snow Leopard on my 15" MacBook Pro without using its DVD drive?
I'm assuming your dvd drive is broken? if you have a thumb drive large enough (8GB or better), you can use another computer to make a bootable image from the install dvd to the thumb drive. then you can install from the the thumb drive.
Ihttp://www.maciverse.com/install-os-x-snow-leopard-from-usb-flash-drive.html
that's a step by step walkthrough. -
How can you connect your iPod touch to your Vista computer without using Apple Software
How do you connect an iPod touch to your Vista computer without using any Apple products
There is no other legit way to sync your iPod than using iTunes. There is 3rd party software to transfer content from the iPod to your computer, but not from the computer to your iPod.
Disk mode is not supported.
See also: http://www.apple.com/ipodtouch/specs.html -
As i had said, I have an Apple Powerbook G4, and my monitor doesn't function. I have an external display Monitor, however it's stuck in extended screen mode. How do I get it to mirror or duplicate the display without use of the on-board? Is there a Fn key combo i'm missing or is the issue more serious then i realize? any and all help and hints would be greatly apprichiated, thanks in advance.
-Powerbook UserThe PowerBooks have an F-key that toggles mirrored and extended mode. My PB is loaned out right now but I think it was f7. The keycap has an icon on two overlapping rectangles, as I recall.
EDIT: Yes! Found a pdf of the PB manual it shows F7 is the toggle: -
I just downloaded Autocad to my downloads file, how do I take it from there to my Parallels Desktop without using "Windows Explorer"?
Did you download it from Adobe or a pop up? If it was a pop up do not open it. Make sure you only get it directly from Adobe here:
http://get.adobe.com/flashplayer/
There is some malware that poses as Flash, in pop ups.
Then do as macbig explained double click on the file,
After you open and install the .dmg reboot your computer to complete the installation -
How to add byte[] array based Image to the SQL Server without using parameter
how to add byte[] array based Image to the SQL Server without using parameter.I have a column in table with the type image in sql and i want to add image array to the sql image column like below:
I want to add image (RESIM) to the procedur like shown above but sql accepts byte[] RESIMI like System.Drowing. I whant that sql accepts byte [] array like sql image type
not using cmd.ParametersAdd() method
here is Isle() method contentSQL Server binary constants use a hexadecimal format:
https://msdn.microsoft.com/en-us/library/ms179899.aspx
You'll have to build that string from a byte array yourself:
byte[] bytes = ...
StringBuilder builder = new StringBuilder("0x", 2 + bytes.Length * 2);
foreach (var b in bytes)
builder.Append(b.ToString("X2"));
string binhex = builder.ToString();
That said, what you're trying to do - not using parameters - is the wrong thing to do. Not only it is insecure due to the risk of SQL injection but in the case of binary data is also inefficient since these hex strings are larger than the original byte[]
data. -
How to update and insert the records without using Table_comparison and Map_operation?
Use either join or MERGE see this Inserting, Updating, and Deleting Data by Using MERGE
-
How can we find all the available user-exits in sap without using SMOD?.
How can we find all the available user-exits in sap without using SMOD?.
Hi,
Please check this links for user exits list.
http://www.planetsap.com/Userexit_List.htm
http://www.easymarketplace.de/userexit.php
http://www.sap-img.com/ab038.htm
Regards,
Ferry Lianto -
Hi
I am using iphone 3gs running on ios 5.1.1
I didn't find any software update option at any place in setting.
Please tell me how can i get it or how i would be able to download and install ios update without using computerJust use the phone the way it is, forget the apps.
Maybe you are looking for
-
Logic 7 waveforms not loading in logic 8
Hi, please help! i had a bunch of stuff recorded in logic 7 (from someone else's computer) that i'm trying to load on my logic 8. when i load the projects, none of the waveforms for the tracks show up, it's just blank. i can still play the tracks, bu
-
Two iphones on the same itunes account can have access to each other's messages?
can 2 iphones on the same itunes account to read each other's messages somehow?
-
Can I use home sharing for AppleTV with Time Capsule and have my iMac powered off?
I wish to be able to use AppleTV without having my iMac powered on. Is there a way to have my iTunes library on my Time Capsule so I can use AppleTV directly from it?
-
Hello all, When I type a search into Google and hit enter, I get to a page that looks like results from Google. When I click on one of the results, I am redirected to a page that has goooogle.osa.pl as the URL. Can anyone tell me how to fix this?
-
Can't use macbook after installing 10.7.5
Yesterday I upgraded to 10.7.5 and today I can't use my macbook pro. It doesn't go past the start up screen. I can't use the curser. It's just sits there. I forced it to restart and the same issue occurs. Can someone please suggest what to do? I