GROUPING

I am trying use “Purchase Line” table to make a report, but, I have a problem here, under the same table, can I do the grouping? I wanna to group the PO number, amount, Qty by Fund No, Shortcut Dimension 2, but, when I put Fund No, Shortcut Dimension 2 into Group Header and PO number, amount, Qty into Body and run it, it only displays the body, the group header(Fund No & Shortcut dimension Code 2) is disappeared from the report, does anyone know why? What did I do wrong?

Grouping is of course possible, but consider the following points: - the order of the grouping is very important as during runtime they cannot be switched. - you usually do not “group” by amounts or quantities, rather by Codes, Dimensions, or No. - grouping is different to “sorting”, though the sorting must be realized respecting the required grouping - this means the first fields of your selected key must be exactly the fields you want to sort by. So in your example, I understand you want to show purchase lines per Fund No. and then show the lines sorted by PO No. Put Fund No. into the GroupTotalFields dataitem property. Select a sorting that starts with Fund No. and then any further sorting you want to apply. If the selected key doesn’t have the same order as your desired grouping the resulting report will not show the data correctly. Saludos Nils

I put Fund No. Shortcut Dimension Code 2 into the GroupTotalFields already, So, do I need to create a Group Header and put Fund No and Shortcut Dimension Code2 into either Group Header or Group Footer?

To be very precise, you don’t have to, unless you want that information to be printed, what I guess is the case. The most important part is, that you use a key for that report that matches your GroupTotalFields, therefore you must have a key that starts with Fund No., Shortcut Dimension 2 Code… Saludos Nils

Thanks Nil! There’s another problem created. When I preview the report, each group has two pages, the first page just have Fund No and Shortcut Dimension Code 2 on it and without body, the second page includes the Group Header and the body. Do u know why and how to take the first page out? I just wanna group it by Fund No and Shortcut Dimension and want them to be displayed on the Group Header, also, I want to have a new page per group, so, I set the NEWPAGEPERGROUP = YES.

As you have 2 groupings and indicate NewPagePerGroup, you’ll have a new page for each new Fund No. and new Global Dimension 2 Code, therefore each new code in any of these 2 groups will cause you a new page. Rather than using the NewPagePerGroup property I would create the new page via code, at the indicated section, and use “CurrReport.NEWPAGE” (have a look at the online help for an example). Saludos Nils

I also tried to put the following codes under the Group Header, but, it gives me more extra pages. Purchase Line, GroupHeader (2) - OnPreSection() IF CurrReport.TOTALSCAUSEDBY IN [FIELDNO(“Purchase Line”.“Fund No.”), FIELDNO(“Purchase Line”.“Shortcut Dimension 3 Code”)] THEN CurrReport.SHOWOUTPUT(FALSE); IF CurrReport.TOTALSCAUSEDBY IN [FIELDNO(“Purchase Line”.“Fund No.”), FIELDNO(“Purchase Line”.“Shortcut Dimension 3 Code”), FIELDNO(“Purchase Line”.“Shortcut Dimension 2 Code”)] THEN CurrReport.NEWPAGE; Result: It totally came out 10 pages. Page 1&2&3 are blank with report header, page 4 is the first group, page5&6 are blank with report heaer only, page 7 is the second group, page 8&9 are blank with report header header, page 10 is the third group. Can you tell me why and how to solve it? Thanks!

I recommend that you try debugging the whole report execution that you better understand the grouping feature. The GroupHeader(2) section gets called every time the sistems completes any of you three groups, therefore you have 3 blank pages at the beginning… 1) Fund No. is a new group, calls the groupheader → new page 2) Shortcut Dimension3 is a new group, calls the groupheader → new page 3) Shortcut Dimension2 is a new group, calls the groupheader → new page Let me know how your report should look like, but to start with: IF CurrReport.TOTALSCAUSEDBY = FIELDNO(“Purchase Line”.“Fund No.”) THEN CurrReport.NEWPAGE; This code should go into a GroupFooter (e.g. with Width 0), to avoid a blank first page! Any new Fund No. should then appear on a new page. Saludos Nils

Nils, You are so excellent, I put the code into Group Footer, it works now, only one page per group!!! One more question, for you, besides the first group header, I wanna add one more group header for putting PO number into it, should I just create another group header and put PO number into it? Actually, my report should look like this: Fund No Shortcut Dimension Code 2 Shortcut Dimen Code 3 PO Number Line No Description Qty UnitCost Amount ---------------------------------------------------------------------------------- F12345 1112 444 PO12345 1 Slide Box 5 $1.00 $5.00 2 Tubes 6 $2.00 $12.00 Total of PO12345… $17.00 PO3526 1 Pin Holder 2 $5.00 $10.00 Total of PO3526… $10.00 Total… $27.00 ----------------------------------------------------------------------------- Start another Fund No, Shortcut Dimension Code 2, shortcut Dim Code 3 ---------------------------------------------------------------------------------- F5255

Iris, you’re welcome, glad i can help you… [^]

quote:

One more question, for you, besides the first group header, I wanna add one more group header for putting PO number into it, should I just create another group header and put PO number into it?

That’s correct, but you’ll have to add the following code, to make sure that each group header appears when it should appear… 1) OnPreSection of your first GroupHeader → to print Fund No., Dim 3 & 2 CurrReport.SHOWOUTPUT(CurrReport.TOTALSCAUSEDBY = FIELDNO(“Purchase Line”.“Fund No.”)); 2) OnPreSection of our second GroupHeader → to print the PO No. CurrReport.SHOWOUTPUT(CurrReport.TOTALSCAUSEDBY = FIELDNO(“Purchase Line”.“PO No.”)); Saludos Nils

I have a question here, why do I just put “Fund No” into TOTALSCAUSED BY funtion? Coz I wanna group it by Fund No, Dim 2 & Dim 4.

Iris, looking at the structure of your report, you “print” those 3 fields, but the field that would trigger a new group is just Fund No. (I assume) and not all 3 of them… otherwise you would have some structure like this: Global Dimension 2 1112 Global Dimension 4 444 Fund No. F12345 Fund No. F12346 If this is the case, I’d rather create 3 group headers and print each section when it gets triggered by a new group.