Integer dataitem in Report

roshiniroshini Member Posts: 122
Hi Nav Experts!!

I am developing one report, I am facing problem, unable to print values as per area code

I am getting records as follows:

batchno area code quantity

C01 001 2
C01 002 1
C01 003 4
C01 004 1
C02 001 3
C02 002 2
C03 001 4
C03 003 4

I want to print total quantity as per area code,
example as follows:

area code quantity
001 9
002 3
003 8
004 1

I want to use integer dataitem or any other solution,as don't want to change the structure of database as it will refluct on other areas.

Can I get any help

Thanks

Comments

  • DaveTDaveT Member Posts: 1,039
    Hi,

    You can use (or create if needed) a key on the area code and then use the TotalFields and GroupTotalFields properties (or use the createtotals command)
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • roshiniroshini Member Posts: 122
    Hi Mr. Dave,

    I created key for area code but not use.

    My Dataitems are:

    Item Journal Batch
    >Item Journal Line
    >>Posted Count/Picking Header
    >>>Posted Count/Picking Lines

    Item Journal Batch - for Item Journal batch no.

    Item Journal Line link with Item Journal Template Name

    Posted Count/Picking Header Linked with Iem Journal Batch Name,Document Date

    here the problem arising with Posted Count/Picking Lines

    Posted Count/Picking Lines Linked with Type,Batch No.( 1. Type --> either Count/Picking and 2. batchno --> Count/Picking batchno.)

    Area Code is located in Posted Count/Picking Header and Posted Count/Picking Lines.

    so getting the result as mentioned.
  • DaveTDaveT Member Posts: 1,039
    Hi Roshini,

    Not as simple as it first seemed. As I see it you have two options

    1. Create a temporary table and store the area value in there and use an integer dataitem to print it.

    2. Restructure your report by i) putting an area loop outside or ii) use the Posted Count/Picking Lines as the primary dataitem with the batches as lookups.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • roshiniroshini Member Posts: 122
    Hi Mr. Dave,

    I don't have idea on temporary integer dataitem, I never used. I requested for this help!


    Thanks
  • roshiniroshini Member Posts: 122
    Hi Mr. Dave,

    Can get any example. the same way as the situtaion..


    Thanks
  • Sandeep_PrajapatiSandeep_Prajapati Member Posts: 151
    Hi roshini,
    Here is a sample report object for your solution. It stores the "Entry Type" in an array and "Quantity" for corresponding "Entry Type" in another array. In integer dataItem, the array values are getting printed.

    I hope it helps :P
    OBJECT Report 90000 Test
    {
      OBJECT-PROPERTIES
      {
        Date=11/26/07;
        Time=[ 5:38:07 PM];
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
      }
      DATAITEMS
      {
        { PROPERTIES
          {
            DataItemTable=Table32;
            DataItemTableView=SORTING(Entry No.)
                              ORDER(Ascending);
            OnPreDataItem=BEGIN
                               CLEAR(EntryTypeArray);
                               CLEAR(EntryTypeQtyArray);
                               j := 1;
                          END;
    
            OnAfterGetRecord=BEGIN
                                  Found := FALSE;
    
                                  FOR i := 1 TO j DO
                                  BEGIN
                                     IF (EntryTypeArray[i] =  FORMAT("Entry Type")) THEN BEGIN
                                       EntryTypeQtyArray[i] := EntryTypeQtyArray[i] + Quantity;
                                       Found := TRUE;
                                     END;
                                  END;
    
                                  IF NOT(Found) THEN BEGIN
                                    j := j + 1;
                                    EntryTypeArray[j] :=  FORMAT("Entry Type");
                                    EntryTypeQtyArray[j] := Quantity;
                                  END;
                             END;
    
            TotalFields=Quantity;
          }
          SECTIONS
          {
            { PROPERTIES
              {
                SectionType=Header;
                PrintOnEveryPage=Yes;
                SectionWidth=18150;
                SectionHeight=1692;
              }
              CONTROLS
              {
                { 1102753001;Label  ;0    ;0    ;7500 ;423  ;FontSize=8;
                                                             FontBold=Yes;
                                                             CaptionML=ENU=Item Ledger Entry }
                { 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
              {
                { 1102753009;Label  ;0    ;0    ;1650 ;846  ;ParentControl=1102753008;
                                                             VertAlign=Bottom;
                                                             FontSize=9;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1102753012;Label  ;2550 ;0    ;1500 ;846  ;ParentControl=1102753011;
                                                             VertAlign=Bottom;
                                                             FontSize=9;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1102753015;Label  ;4200 ;0    ;2100 ;846  ;ParentControl=1102753014;
                                                             VertAlign=Bottom;
                                                             FontSize=9;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
                { 1102753018;Label  ;7950 ;0    ;1800 ;846  ;Name=Quantity;
                                                             HorzAlign=Right;
                                                             VertAlign=Bottom;
                                                             FontSize=9;
                                                             FontBold=Yes;
                                                             MultiLine=Yes }
              }
               }
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=18150;
                SectionHeight=423;
              }
              CONTROLS
              {
                { 1102753008;TextBox;0    ;0    ;1500 ;423  ;HorzAlign=Right;
                                                             SourceExpr="Entry No." }
                { 1102753011;TextBox;2550 ;0    ;1500 ;423  ;HorzAlign=Left;
                                                             SourceExpr="Item No." }
                { 1102753014;TextBox;4200 ;0    ;2100 ;423  ;HorzAlign=Left;
                                                             SourceExpr="Entry Type" }
                { 1102753000;TextBox;7950 ;0    ;1800 ;423  ;HorzAlign=Right;
                                                             SourceExpr=Quantity }
              }
               }
            { PROPERTIES
              {
                SectionType=Footer;
                SectionWidth=18150;
                SectionHeight=846;
              }
              CONTROLS
              {
                { 1102753010;TextBox;7950 ;0    ;1800 ;423  ;HorzAlign=Right;
                                                             FontSize=9;
                                                             FontBold=Yes;
                                                             SourceExpr=Quantity }
                { 1102753013;Shape  ;0    ;423  ;18150;423  ;ShapeStyle=HorzLine }
              }
               }
          }
           }
        { PROPERTIES
          {
            DataItemTable=Table2000000026;
            DataItemTableView=SORTING(Number)
                              ORDER(Ascending);
            OnPreDataItem=BEGIN
                               i := 1;
                          END;
    
            OnAfterGetRecord=BEGIN
                                  i := i + 1;
                                  IF (EntryTypeArray[i] = '') THEN CurrReport.BREAK;
                             END;
    
          }
          SECTIONS
          {
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=18150;
                SectionHeight=423;
              }
              CONTROLS
              {
                { 1102753007;TextBox;4050 ;0    ;2250 ;423  ;SourceExpr=EntryTypeArray[i] }
                { 1102753016;TextBox;7950 ;0    ;1950 ;423  ;SourceExpr=EntryTypeQtyArray[i] }
              }
               }
          }
           }
      }
      REQUESTFORM
      {
        PROPERTIES
        {
          Width=9020;
          Height=3410;
        }
        CONTROLS
        {
        }
      }
      CODE
      {
        VAR
          EntryTypeArray@1102753000 : ARRAY [10] OF Text[30];
          EntryTypeQtyArray@1102753001 : ARRAY [10] OF Integer;
          i@1102753002 : Integer;
          j@1102753003 : Integer;
          Found@1102753004 : Boolean;
    
        BEGIN
        END.
      }
    }
    
    Sandeep Prajapati
    Technical Consultant, MS Dynamics NAV
  • roshiniroshini Member Posts: 122
    Hi Sandeep Prajapati,

    Excellent !

    Thanks a lot....

    I am really looking for this type solution, as I never worked on integer, I don't know the process,

    Thanks for providing good solution.
Sign In or Register to comment.