Validate fields when importing data

DraqosDraqos Member Posts: 36
edited 2004-09-01 in Navision Financials
Hi. I am importing sales header and sales line from XL into Navision.
The thing is the XL only has "Sell to customer No." field, an what I want to do is validate it, in order to let Navision check and complete all other fields acording to the customer No..

I have adde code in the OnAfterImport that does this SalesHeader.VALIDATE("sell-to Customer No.")
and now the dataport runs, but it does not actually import any records, even though AutoSave is set to YES. :?

So... SOMEONE HELP ME, PLEASE !!!!
"Simplicity is the ultimate sophistication."
Leonardo DaVinci

Comments

  • StephenGStephenG Member Posts: 99
    Hi

    When I design dataports for importing I always have
    AutoSave,AutoUpdate, and AutoReplace set to NO.
    Insert and Modify are then set with code on the OnAfterImport trigger along with any Validation, Checks and assignments.
    From OnLine help for AutoSave
    If AutoSave is No, you will have to insert records yourself, by using C/AL code in the OnAfterImportRecord trigger. This is, for example, necessary in situations where you have to perform some processing to decide if the record should be inserted, or to calculate or retrieve additional data before inserting the record.
    Answer the question and wait for the answer.
  • DraqosDraqos Member Posts: 36
    Thanx, I do that also.... :)
    My problem was with the Navision instalation(or the database). If I close and reopen Navision, for some unknown reason, the dataport works just like it should...
    Took some time to figger that out :)
    "Simplicity is the ultimate sophistication."
    Leonardo DaVinci
  • kinekine Member Posts: 12,562
    May be you run dataport from designer (when you are designing dataport) - data are not commited. Dataport must be run from object designer (list of objects) or from some menu etc. It is standard functionality.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    I guess the reason is that, when you are designing a dataport, and run it, no data gets imported.
    But when you run the dataport from the object designer, it will.
    This let you test the dataport while designing, without any records being created. After the development, you need to run the dataport from the object designer.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • DraqosDraqos Member Posts: 36
    You are right ! :D
    I was running the dataport from design mode.
    Thanx a lot.
    "Simplicity is the ultimate sophistication."
    Leonardo DaVinci
Sign In or Register to comment.