Report Question

Hi! I’ making a report that shall display a character based chart “orders per month”. The code looks simplyfied like this: – “Sales Header”.SETFILTER(“Shipment Date”, ‘03-08-01…03-08-31’); No:=“Sales Header”.COUNT; FOR I := 1 TO No DO BEGIN Order:=Order +‘O’; END; — I then display Order in the report. Now I want to show all months there are orders in instead of only August. How could I do this? I also would like the chart with block characters, so I use Lucida console, an OEM font. But the block characters does not print, insted it prints “|” Thanks Petter Jönhagen, Sweden

I don’t really understand what you want to do Maybe this will help: separation by month date1 := CALCDATE(’<-CM-13M>’,WORKDATE); date2 := CALCDATE(’<-CM-12M>’,WORKDATE); date3 := CALCDATE(’<-CM-11M>’,WORKDATE); date4 := CALCDATE(’<-CM-10M>’,WORKDATE); date5 := CALCDATE(’<-CM-9M>’,WORKDATE); date6 := CALCDATE(’<-CM-8M>’,WORKDATE); date7 := CALCDATE(’<-CM-7M>’,WORKDATE); date8 := CALCDATE(’<-CM-6M>’,WORKDATE); date9 := CALCDATE(’<-CM-5M>’,WORKDATE); date10 := CALCDATE(’<-CM-4M>’,WORKDATE); date11 := CALCDATE(’<-CM-3M>’,WORKDATE); date12 := CALCDATE(’<-CM-2M>’,WORKDATE); date13 := CALCDATE(’<-CM-1M>’,WORKDATE); date14 := CALCDATE(’’,WORKDATE); IF (“shipment date” >= date1) AND (“shipment date” < date2) THEN . . . .

Hi Cage, Maybe I was unclear. With my code I get a staple like this in the report: what I want is the a staple for all months I have orders in: 03-08-01…03-08-31 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO 03-09-01…03-08-30 OOOOOOOOOOOOOOOOOOOOOOOO 03-10-01…03-10-31 OOOOOOOOOOOOOOOO 03-11-01…03-11-30 OOOOOOOOOOOOOOOOOOOOOO etc… Kind Regards Petter Jönhagen, Sweden

Hi You could try something like this Global Vars Date Rec Date PerStart Date Dimension 12 PerEnd Date Dimension 12 PerText Text 30 Dimension 12 Order Text Dimension 12 j Integer OnPerReport Date.SETRANGE("Period Type",Date."Period Type"::Month); Date.SETRANGE("Period Start",0D,Workdate); IF Date.FIND('+') THEN BEGIN i := 12; REPEAT PeriodText[i] := Date."Period Name"; PeriodStart[i] := Date."Period Start"; PeriodEnd[i] := Date."Period End"; i := i - 1; Date.NEXT(-1); UNTIL i = 0; END; Then in the report FOR j := 1 to 12 do begin "Sales Header".SETRANGE("Shipment Date",PerStart[j],PerEnd[j]); No := "SalesHeader".COUNT; For i := 1 to No do Order[j] := Order[j] + 'o' END; The Dimesions can be any figure you like, i chose 12 to show a rolling 12 months

Petter My previous reply will work if want x number of columns. if you want x.number of rows, then use the Date Table as a DateItem then filter “Sales Header” using the “Period Start” and “Period End” on each iteration of the Date DataItem. This way you do not need to use arrays. I should of thought of this earlier [:I]

Thanks Steve! Your code works for me now. Although I do not really understand your follow-up on how to not have to use arrays. Thanks anyway! /Petter

Hi Solution that comes to my mind is something like this Accept date range from user as input - FromDate and ToDate Declare a global date variable - say DateVar OnPreDataItem - DateVar := FromDate OnAfterGetRecord if Date2DMY(DateVar, 2) = Date2DMY(ToDate, 2) then LastRun := true // boolean var to indiacate last loop to be run if not LastRun then SalesHeader.setfilter( “shipment Date”, ‘%1…%2’, DateVar, calcdate(DateVar, ‘1M’ ); else begin if DateVar < Todate then SalesHeader.setfilter( “…”, ‘%1…%2’, DateVar , ToDate) else SalesHeader.setfilter( “…”, ‘%1…%2’, ToDate, DateVar) end; … … … if not lastRun then dateVar := calcdate( dateVar, ‘1M’ ); OnPostSection - Body if LastRun then CurrReport.break;

Petter Clarify part2 of my posting Variable SalesHeader Record “Sales Header” You have the Table Date as the DataItem with the filters OnPreDataItem SETRANGE(“Period Type”,Date.“Period Type”::Month); SETRANGE(“Period Start”,01/01/03,31/12/03); OnAfterGetRecord SalesHeader.SETRANGE(“Document Type”,SalesHeader.“Document Type”::Order); SalesHeader.SETRANGE(“Shipment Date”,Date.“Period Start”,Date."Period End); No := SalesHeader.COUNT; For i := 1 to No do Order := Order + ‘o’; Output “Period Start”,“Period End” and Order on Date.Body Report Section. Or You could Have “Sales Header” as an Indented DateItem after Date instead of a Variable.

Hi Steve! I finished my (beautiful) report this weekend with help of your part1 post. But this is even better solution! It is really what I was looking for. I think I will rework the report now… Thanks again.