Report Code

Hi Everyone,

I have Problem, Like i am writing a code for a report to excell. I am strucked at point like,

The code i wrote is, can take report on the base of months. like Jan, feb …etc.

Now,what i am looking for is the filter that should match with the table field which is Tempory table, In that the fields are months like Jan, feb,…etc.It Should match with give month in the report.And calcSums of the Field to the tempory table,

Tempory Table = SalesTarget,

Month = the month i am taking in the report,for expl january.

IF Month = Month :: January THEN
Sales :=0;
SalesTarget.CALCSUMS(SalesTarget.Jan);
Sales:=SalesTarget.Jan;
IF Month = Month:: February THEN
Sales :=0;
SalesTarget.CALCSUMS(SalesTarget.Feb) ;
Sales:=SalesTarget.Feb;
IF Month = Month :: March THEN
Sales :=0;
SalesTarget.CALCSUMS(SalesTarget.Mar);
Sales:=SalesTarget.Mar;
IF Month = Month:: April THEN
Sales :=0;
SalesTarget.CALCSUMS(SalesTarget.Apr);
Sales:=SalesTarget.Apr;
IF Month = Month:: May THEN
Sales :=0;
SalesTarget.CALCSUMS(SalesTarget.May);
Sales:=SalesTarget.May;
IF Month = Month:: June THEN
Sales :=0;
SalesTarget.CALCSUMS(SalesTarget.Jun);
Sales:=SalesTarget.Jun;
IF Month = Month:: July THEN
Sales :=0;
SalesTarget.CALCSUMS(SalesTarget.Jul);
Sales:=SalesTarget.Jul;
IF Month = Month:: August THEN
Sales :=0;
SalesTarget.CALCSUMS(SalesTarget.Aug);
Sales:=SalesTarget.Aug;
IF Month = Month:: September THEN
Sales :=0;
SalesTarget.CALCSUMS(SalesTarget.Sep);
Sales:=SalesTarget.Sep;
IF Month = Month:: October THEN
Sales :=0;
SalesTarget.CALCSUMS(SalesTarget.Oct);
Sales:=SalesTarget.Oct;
IF Month = Month:: November THEN
Sales :=0;
SalesTarget.CALCSUMS(SalesTarget.Nov);
Sales:=SalesTarget.Nov;
IF Month = Month:: December THEN
Sales :=0;
SalesTarget.CALCSUMS(SalesTarget.Dec);
Sales:=SalesTarget.Dec;
Entercell(Row-3,SernialNo+2,FORMAT(Sales),TRUE,FALSE,FALSE);

If i am taking the Month Dec in the report, then it is calulating the total of all months.

Hi Naveen,

Not sure what you are asking. The code may (eventually) work but I think you would be better re-thinking the design.

Firstly you should be using a CASE statement.

I suspect the you are getting the overall total even when selecting a month - you will need to set a filter on the SalesTarget table.