SubGroup By Date

shivaprasad263shivaprasad263 Member Posts: 70
Hi,

I created a new report with dataitem purchase line to print details like:

Item Q Date
A 1 06/20/08
B 2 06/30/08
C 5 07/01/08
---
---
Now i want to group by month like

Item Q Date
A 1 06/20/08
B 2 06/30/08
Group By June :3
C 5 07/01/08
Group By July :5
---
---
Is there any simple scenario to do like this way.

Comments

  • Sandeep_PrajapatiSandeep_Prajapati Member Posts: 151
    I just tried to do what you wanted.....

    here is the object..... I have used [Expected Receipt Date], replace it according to your requirement and do the Formatting

    OBJECT Report 50005 Grouping By month
    {
      OBJECT-PROPERTIES
      {
        Date=07/02/08;
        Time=[ 3:09:50 PM];
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
      }
      DATAITEMS
      {
        { PROPERTIES
          {
            DataItemTable=Table39;
            DataItemTableView=SORTING(Document Type,Type,No.,Variant Code,Drop Shipment,Location Code,Expected Receipt Date)
                              ORDER(Ascending);
            TotalFields=Quantity;
            GroupTotalFields=Expected Receipt Date;
          }
          SECTIONS
          {
            { PROPERTIES
              {
                SectionType=Header;
                PrintOnEveryPage=Yes;
                SectionWidth=18150;
                SectionHeight=1692;
              }
              CONTROLS
              {
                { 1102753001;Label  ;0    ;0    ;7500 ;423  ;FontSize=8;
                                                             FontBold=Yes;
                                                             CaptionML=ENU=Purchase Line }
                { 1102753002;TextBox;15000;0    ;3150 ;423  ;HorzAlign=Right;
                                                             SourceExpr=FORMAT(TODAY,0,4) }
                { 1102753003;TextBox;0    ;423  ;7500 ;423  ;SourceExpr=COMPANYNAME }
                { 1102753004;TextBox;17700;423  ;450  ;423  ;CaptionML=ENU=Page;
                                                             SourceExpr=CurrReport.PAGENO }
                { 1102753005;Label  ;16950;423  ;750  ;423  ;ParentControl=1102753004 }
                { 1102753006;TextBox;15900;846  ;2250 ;423  ;HorzAlign=Right;
                                                             SourceExpr=USERID }
              }
               }
            { PROPERTIES
              {
                SectionType=Header;
                PrintOnEveryPage=Yes;
                SectionWidth=18150;
                SectionHeight=1269;
              }
              CONTROLS
              {
                { 1102753030;Label  ;0    ;0    ;1500 ;846  ;ParentControl=1102753029;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1102753033;Label  ;1650 ;0    ;1800 ;846  ;ParentControl=1102753032;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1102753036;Label  ;3600 ;0    ;1800 ;846  ;ParentControl=1102753035;
                                                             VertAlign=Bottom;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
              }
               }
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=18150;
                SectionHeight=423;
                OnPreSection=BEGIN
                               MonthTotalPrinted := FALSE;
                               MonthWiseQty := MonthWiseQty + Quantity;
                               MonthInt := DATE2DMY("Promised Receipt Date",2);
                               CurrReport.SHOWOUTPUT((PrevMonth <> MonthInt) AND (PrevMonth <> 0) );
                               IF CurrReport.SHOWOUTPUT = TRUE THEN
                               BEGIN
                                 MonthTotalPrinted := TRUE;
                                 MonthWiseQty := MonthWiseQty - Quantity;
                               END;
                             END;
    
              }
              CONTROLS
              {
                { 1102753000;TextBox;5400 ;0    ;3000 ;423  ;HorzAlign=Right;
                                                             FontSize=8;
                                                             FontBold=Yes;
                                                             SourceExpr=MonthWiseQty }
                { 1102753007;TextBox;0    ;0    ;4950 ;423  ;HorzAlign=Right;
                                                             FontSize=8;
                                                             FontBold=Yes;
                                                             SourceExpr='TOTAL FOR MONTH  :   ' + FORMAT(PrevMonth) }
              }
               }
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=18150;
                SectionHeight=423;
              }
              CONTROLS
              {
                { 1102753029;TextBox;0    ;0    ;1500 ;423  ;HorzAlign=Left;
                                                             SourceExpr="No." }
                { 1102753032;TextBox;1650 ;0    ;1800 ;423  ;HorzAlign=Right;
                                                             SourceExpr=Quantity }
                { 1102753035;TextBox;3600 ;0    ;1200 ;423  ;HorzAlign=Left;
                                                             SourceExpr="Promised Receipt Date" }
                { 1102753010;TextBox;5400 ;0    ;2700 ;423  ;HorzAlign=Left;
                                                             SourceExpr=MonthWiseQty }
              }
               }
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=18150;
                SectionHeight=0;
                OnPreSection=BEGIN
                                 PrevMonth := MonthInt;
                                 IF MonthTotalPrinted THEN
                                    MonthWiseQty := Quantity;
                             END;
    
              }
              CONTROLS
              {
              }
               }
            { PROPERTIES
              {
                SectionType=Footer;
                SectionWidth=18150;
                SectionHeight=423;
              }
              CONTROLS
              {
                { 1102753008;TextBox;0    ;0    ;5100 ;423  ;HorzAlign=Right;
                                                             FontSize=8;
                                                             FontBold=Yes;
                                                             SourceExpr='TOTAL FOR MONTH  :   ' + FORMAT(PrevMonth) }
                { 1102753009;TextBox;5400 ;0    ;3000 ;423  ;HorzAlign=Right;
                                                             FontSize=8;
                                                             FontBold=Yes;
                                                             SourceExpr=MonthWiseQty }
              }
               }
          }
           }
      }
      REQUESTFORM
      {
        PROPERTIES
        {
          Width=9020;
          Height=3410;
        }
        CONTROLS
        {
        }
      }
      CODE
      {
        VAR
          LastFieldNo@1102753000 : Integer;
          FooterPrinted@1102753001 : Boolean;
          TotalFor@1102753002 : TextConst 'ENU="Total for "';
          MonthWiseQty@1102753003 : Integer;
          MonthName@1102753004 : Text[30];
          MonthInt@1102753005 : Integer;
          PrevMonth@1102753006 : Integer;
          MonthTotalPrinted@1102753007 : Boolean;
    
        BEGIN
        END.
      }
    }
    
    
    
    
    
    
    
    Sandeep Prajapati
    Technical Consultant, MS Dynamics NAV
Sign In or Register to comment.