dataport

WhiteSpiritWhiteSpirit Member Posts: 7
edited 2007-03-19 in Navision Attain
Hello,

I need to make a filter on fields in a dataport, its fields I declared them as variables to be able to export the data in a single line, because I am going to export the data of two tables and I declared only the only one.

Thank you in advance

Comments

  • AlbertvhAlbertvh Member Posts: 516
    in the OnBeforeExport section

    MyRecVar2.GET(Field);
    MyExportField1 := MyRecVar2.Field1
    ......


    where
    MyRecVar2 is of type Record
    Field1 is of type MyRecVar2.Field1

    Hope this helps
  • WhiteSpiritWhiteSpirit Member Posts: 7
    Hello

    but I would want that the fields on which I have make the filtes that they are visible by the user so that he can make a filter
  • AlbertvhAlbertvh Member Posts: 516
    Are these 2 Tables linked and if so is it a one to one?

    If the answer is yes then you could do the following

    Set 3 DataItems
    MyRec1
    MyRec2
    Integer

    Don't set the properties for DataItemTableView.
    Declare 2 Variables
    MyRec3 same as MyRec1
    MyRec4 same as MyRec2

    In Integer OnPreDataItem
    MyRec3.COPYFILTERS(MyRec1);
    if MyRec2.COUNT = 0 THEN
    CurrDataport.QUIT;
    MyRec4.COPYFILTERS(MyRec2);
    SETRANGE(Number,1,MyRec3.COUNT);

    In OnBeforeExportRecord section
    If Number = 1 THEN
    MyRec3.FIND('-')
    ELSE
    MyRec3.NEXT;

    add coding to deal with MyRec4 and then fill in the variable fields
    of the data you want to export.

    Regards
    Albert
Sign In or Register to comment.