Report items on the same line

sp4tcsp4tc Member Posts: 16
I am trying to create a report that shows inventory against Global Dimension 1 to get the ship to address the inventory was produced for, so far I have
OBJECT Report 50042 Inventory Availability 
{
  OBJECT-PROPERTIES
  {
    Date=16/05/08;
    Time=13:57:13;
    Modified=Yes;
    Version List=SP40001;
  }
  PROPERTIES
  {
    CaptionML=[ENU=Inventory Availability;
               ENG=Inventory Availability];
  }
  DATAITEMS
  {
    { PROPERTIES
      {
        DataItemTable=Table27;
        DataItemTableView=SORTING(No.)
                          WHERE(Inventory=FILTER(>0),
                                Item Category Code=FILTER(FIN*));
        PrintOnlyIfDetail=Yes;
        OnAfterGetRecord=BEGIN
                           tnavref :='';
                           tno :='';
                           tdesc :='';
                           tno := Item."No.";
                           tdesc := Item.Description;
                           tqty := Item.Inventory;
                           tnavref := "Item Ledger Entry"."Global Dimension 1 Code"
                         END;

        ReqFilterFields=No.;
      }
      SECTIONS
      {
        { PROPERTIES
          {
            SectionType=Header;
            SectionWidth=18600;
            SectionHeight=846;
          }
          CONTROLS
          {
            { 1040001;Label     ;0    ;0    ;1500 ;846  ;ParentControl=1040000;
                                                         VertAlign=Bottom;
                                                         FontBold=Yes;
                                                         MultiLine=Yes }
            { 1040003;Label     ;1650 ;0    ;4500 ;846  ;ParentControl=1040002;
                                                         VertAlign=Bottom;
                                                         FontBold=Yes;
                                                         MultiLine=Yes }
            { 1040005;Label     ;6300 ;0    ;1800 ;846  ;ParentControl=1040004;
                                                         HorzAlign=Right;
                                                         VertAlign=Bottom;
                                                         FontBold=Yes;
                                                         MultiLine=Yes }
            { 1040009;Label     ;8250 ;0    ;4500 ;846  ;ParentControl=1040008;
                                                         VertAlign=Bottom;
                                                         FontBold=Yes;
                                                         MultiLine=Yes;
                                                         CaptionML=ENG=NavRef }
          }
           }
        { PROPERTIES
          {
            SectionType=Body;
            SectionWidth=18600;
            SectionHeight=423;
          }
          CONTROLS
          {
            { 1040000;TextBox   ;0    ;0    ;1500 ;423  ;SourceExpr=tno }
            { 1040002;TextBox   ;1650 ;0    ;4500 ;423  ;SourceExpr=tdesc }
            { 1040004;TextBox   ;6300 ;0    ;1800 ;423  ;SourceExpr=Inventory }
            { 1040008;TextBox   ;8250 ;0    ;4500 ;423  ;SourceExpr=tnavref }
          }
           }
      }
       }
    { PROPERTIES
      {
        DataItemIndent=1;
        DataItemTable=Table32;
        DataItemTableView=SORTING(Item No.,Posting Date);
        DataItemLink=Item No.=FIELD(No.);
      }
      SECTIONS
      {
        { PROPERTIES
          {
            SectionType=Body;
            SectionWidth=18600;
            SectionHeight=0;
          }
          CONTROLS
          {
          }
           }
      }
       }
    { PROPERTIES
      {
        DataItemIndent=1;
        DataItemTable=Table36;
        DataItemTableView=SORTING(Document Type,No.);
        DataItemLinkReference=Item Ledger Entry;
        DataItemLink=Shortcut Dimension 1 Code=FIELD(Global Dimension 1 Code);
      }
      SECTIONS
      {
        { PROPERTIES
          {
            SectionType=Header;
            SectionWidth=18600;
            SectionHeight=0;
          }
          CONTROLS
          {
          }
           }
        { PROPERTIES
          {
            SectionType=Body;
            SectionWidth=18600;
            SectionHeight=0;
            KeepWithNext=No;
          }
          CONTROLS
          {
          }
           }
      }
       }
  }
  REQUESTFORM
  {
    PROPERTIES
    {
      Width=3850;
      Height=440;
      SaveValues=Yes;
    }
    CONTROLS
    {
    }
  }
  CODE
  {
    VAR
      tnavref@1040001 : Text[30];
      tno@1040000 : Text[30];
      tdesc@1040002 : Text[30];
      tqty@1040003 : Decimal;

    BEGIN
    {
      
    }
    END.
  }
}


The problem is that Global Dimension one is out of sync with the other fields by one line and I do not know why.

Can anyone help?

Thanks in advance.

Comments

  • kinekine Member Posts: 12,562
    You cannot use "Item Ledger Entry" in the Item dataitem, because the OnAfterGetRecord of Item is processed before the Item ledger entry dataitem. It means that first iteration you are assigning the uninitialized variable and next iteration you are using the "undefined" variable (but in real it is last record from previous loop of the Item Ledger Entry).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.