Missing line in dataport whenusing OnAfterFormatField

jordi79jordi79 Member Posts: 273
Hi All,

i am having some problems in dataport. When I use OnAfterFormatField trigger to assign values to variables that will be exported to a file, the last record is always not exported.

Please refer to object attached... I am using version 5 to perform the tests. The object id is in the range of 80010. And the dataport fileformat is fixed

You can see from the object below, I have filtered the integer table from 1..5. So the export should show 5 lines. But the text file exported only show 1 to 4. With the first line being blank.


Object in text below...
OBJECT Dataport 80020 temp test 123
{
  OBJECT-PROPERTIES
  {
    Date=23-11-09;
    Time=[ 4:21:38 PM];
    Modified=Yes;
    Version List=TEMPTEST;
  }
  PROPERTIES
  {
    FileFormat=Fixed;
  }
  DATAITEMS
  {
    { PROPERTIES
      {
        DataItemTable=Table2000000026;
        DataItemTableView=SORTING(Number)
                          ORDER(Ascending)
                          WHERE(Number=FILTER(1..5));
      }
      FIELDS
      {
        { 1    ;10   ;Val1                ;OnAfterFormatField=BEGIN
                                                                Val1 := '_' + FORMAT(Integer.Number) + '_';
                                                              END;
                                                               }
      }
       }
  }
  REQUESTFORM
  {
    PROPERTIES
    {
      Width=9020;
      Height=3410;
    }
    CONTROLS
    {
    }
  }
  CODE
  {
    VAR
      Val1@1000000000 : Text[30];

    BEGIN
    END.
  }
}

Comments

  • jordi79jordi79 Member Posts: 273
    I think I found my own solution. It is working after I changed the coding to use OnBeforeExport record instead of OnAfterFormatField.
  • kinekine Member Posts: 12,562
    jordi79 wrote:
    I think I found my own solution. It is working after I changed the coding to use OnBeforeExport record instead of OnAfterFormatField.

    That is what I wanted to suggest. OnAfterFormat is mainly for manipulation with the Text parameter which is passed there. You can use it like:
    { 1    ;10   ;Val1                ;OnAfterFormatField=BEGIN
                                                                    Text := '_' + Text + '_';
                                                                  END;
                                                                   }
    
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.