Dataport to existing file

bhuberbhuber Member Posts: 78
edited 2001-03-04 in Navision Financials
I have written a dataport to fill the Navision Customer table. WHre a record already exists in the Table, I would like for the dataport to change fields common to the dataport and table but leave fields that exit only in the table alone. I have tried combinations of auto-save, auto-update and auto-replace but can not get desired results. Any ideas.

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Try this in the OnAfterImportRecord()-trigger:
    IF NOT(INSERT) THEN MODIFY;
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • PellePelle Member Posts: 18
    A safe and straightforward way to accomplish this is:
    a) Define global variables that match the "imported" fields
    i.e. NewItemNo, NetWeight.
    b) Define a global variable that matches your record (Item2)
    c) In the On after Import trigger, use code like
    if Item2.Get(NewItemNo) then
    begin
    if (Item2."Net Weight" = 0 then)
    begin
    Item2."Net Weight" = NetWeight;
    Item2.modify;
    End;
    end;

    This way, the dataport doesn't write anything to the table,
    but you have total control over what happens. Just as whe you run a report.

    Pelle
Sign In or Register to comment.