Need a Dataport for navision

floflo Member Posts: 25
edited 2003-12-15 in Navision Financials
Hi all

I have a Problem in creating a Dataport.
My Problem is that I want to Create a Dataport that only inserts Data to the Table that is not yet in it.

That means I have a csv-file with data that is already in the table and data that has to be imported into it.
I do not want to "update" the data that is already in the table.
I tried it as followed:

Dataport properties:
AutoSave: Yes
AutoReplace: No
AutoUpdate: No

C/AL

OnAfterImportRecord:
IF <Global Var>.GET (Table."Nr.") THEN CurrDataport.SKIP
ELSE IF <Global Var>.GET (Table.Name) THEN CurrDataport.SKIP
ELSE BEGIN
  <Global Var>."Nr." := <Global Var>."Nr.";
      ....
      ....
   <Global Var>.INSERT;
END;

But when I start a RUN of The Dataport I get an Errormessage that tells me that my "Table."Nr." already exists.

I do not know where the fault is in the report ... settings that are not mentioned are all default.

I hope to get an answer soon

Thanks in advance

greetingZ

flo

Comments

  • SbhatSbhat Member Posts: 301
    Hi,

    The clean way of doing this would be create a new Dataport data item with type Integer and one line below the Integer dataitem set the Autosave,Autoupdate and Autoreplace to NO. Then declare all the global variables in Global and put the same fields in the Dataport fields, then go to the code and in the code instead of using a GET use the SETRANGE syntax and if found CurrDataport.skip else INIT and INSERT.

    Thanks
    Best regards
    Suresh.
  • floflo Member Posts: 25
    thnx 4 the reply, but i ve got it already.
    it was the insert-command in the end of my code. i replaced it with update and now it works.
Sign In or Register to comment.