Report Headings that are Flexible

Hello Guys. Am making a Sales Region Analysis Summary Report and i really need help. The report should be in this format:

Horizontal axis - Display all records of Inventory Posting Group Table which is a one record table (so i assume this will be tittles).

Vertical axis - Display Values for Each Gen. Business Posting Group (Gen. Business Posting Group is another table).

My Qs is how do i get the fields of the Inventory Posting Group Table to represent my report heading because i dont want to hardcode them.

Thank you in advance

Hi Fezih,

I’m not quite sure i fully understand what it is you want, but if i get i right, you want sort of a matrix-report, with the values of Inventory Posting Group fields as headers, and then have the figures presented under that, summarized by Gen. Bus. posting group…

This can be done if you define a report with Inventory Posting Group as primary-dataitem, indented under that you can put Gen. Bus. Posting Group.
Now insert a body-section of Inventory posting group, and put the fields you want in that, WITHOUT labels. This section serves as your header-line.
Insert a bodysection of Gen. Bus. Posting Group, wich will present the figures.

Thanx for your reply. Now the next problem is when i preview the report its taking long until i cancels it. Am not sure if it will present some details or not.

Here are the codes and how i designed it for you to look at and share the solution with me please.I would really appreciate yr help.

One (1) data item = Gen. Business Posting Group

Global Variables =

Name DataType Subtype Length
InventoryPGrp Record Inventory Posting Group
GenFilters Text 300
GenBusiPostingGroupAmt Decimal
GenBusiPostingGroupTotals Decimal
InvPostingGrpAmount Decimal
InvPostingGrpTotals Decimal
valueEntry Record Value Entry
Idx Integer
SalesDateFilter Date
SalesDateFilter1 Date

Local Variable =

Name DataType Subtype Length
Jx Integer
Inventory P Group Record Inventory Posting Group

Report - OnPreReport()

GenFilters := “Gen. Business Posting Group”.GETFILTERS;
//Get Inventory Posting Groups
Jx := 1;
IF NOT “Inventory P Group”.FIND (’-’) THEN
ERROR (‘No Inventory Posting Groups are defined’);
REPEAT
InventoryPGrp[Jx]:= “Inventory P Group”;
Jx += 1;
UNTIL “Inventory P Group”.NEXT = 0;

}
IF Item.GETFILTER (“Date Filter”) = ‘’ THEN
ERROR (‘Please specify Date Filter’);
FromDate := Item.GETRANGEMIN (“Date Filter”);
ToDate := Item.GETRANGEMAX (“Date Filter”);
{

Gen. Business Posting Group - OnAfterGetRecord()

InvPostingGrpTotals := 0;
GenBusiPostingGroupTotals := 0;

valueEntry.RESET;
valueEntry.SETCURRENTKEY(“Item Ledger Entry Type”,“Gen. Bus. Posting Group”,“Inventory Posting Group”,“Posting Date”);
valueEntry.SETFILTER(valueEntry.“Item Ledger Entry Type”,‘Sale’);
valueEntry.SETFILTER(valueEntry.“Gen. Bus. Posting Group”,“Gen. Business Posting Group”.Code);

Idx := 1;
REPEAT
GenBusiPostingGroupAmt[Idx] := 0;
valueEntry.SETFILTER(valueEntry.“Inventory Posting Group”,InventoryPGrp[Idx].Code);
valueEntry.SETRANGE(valueEntry.“Posting Date”,SalesDateFilter,SalesDateFilter1);

IF valueEntry.FIND(’-’) THEN
REPEAT
GenBusiPostingGroupAmt[Idx] += valueEntry.“Sales Amount (Actual)”;
UNTIL valueEntry.NEXT = 0;
GenBusiPostingGroupTotals += GenBusiPostingGroupAmt[Idx];
InvPostingGrpTotals += GenBusiPostingGroupAmt[Idx];

UNTIL InventoryPGrp[Idx].Code = ‘’;

IF GenBusiPostingGroupTotals = 0 THEN
CurrReport.SKIP;

NB: when i comment codes for Gen. Business Posting Group - OnAfterGetRecord() , the Headers are well displayed.

I think you run into a never ending loop, in the Gen. Business Posting Group - OnAfterGetRecord-trigger…

You don’t seem to increase the integer-variable: Idx.
Thereby you never reach the point where InventoryPGrp[Idx].Code = ‘’

Also you should consider if you could add a sumindex-field to the key you use, and use the CALCSUMS-function instead of looping through all value-entries.

I inserted a statement to end the loop. I Located it just above this statement

Idx += 1; // This is what i have added
UNTIL InventoryPGrp[Idx].Code = ‘’;

This now ends the loop but funny enough, NO DATA is displayed on the report except the headings (Inventory posting groups) on the horizontal axis and General business posting groups on the vertical axis.

What could this be and how can i solve it. Thanxs

Hi Festus,

I think you show an empty dimension of the variable.

You should really consider redesigning the report as i mentioned earlier.