Manipulating Dataport Data

cschriebercschrieber Member Posts: 15
Hello,

I am new to NAV and NAV development, and have a question about dataports. I am not new to software development and programming.

I have a custom table that holds info about advertising. We have an external (external to NAV) application that maintains the same data. Currently, the worker enters the data in the application, then re-enters the data in NAV. I've been asked to find a way to import the data from the application into the NAV table.

I have learned that using a DataPort, I can pull in the data without a problem. The only thing is, if the key-value changes, or if a row is deleted, the DataPort doesn't make the change, but instead creates a new record (or leaves the initial record alone in the case of a delete).

Is there a way to go through the records and identify what is missing from the data coming from the dataport?

Or, is there a better way to accomplish something like this?

Thank you for your time!
Chad Schrieber
Joyce Meyer Ministries
Fenton, MO USA
http://www.joycemeyer.org

Comments

  • kapamaroukapamarou Member Posts: 1,152
    Use variables for the dataport fields and write code on the dataport.

    If for example, the Primary Key is Entry No. then you can:

    a) If no identical Entry No. exists, then create it.

    b) If an identical Entry No. Exists, overwrite it or apply some logic to update only certain fields.

    c) Keep (in a temporary probably) record the Entry No. s you imported. Then loop through your table again, and for each record, if there is no entry in the temporary variable, delete it. This means that you'll always have to export and import all your records.

    This is just a suggestion. There are many ways to achieve this. You could even skip the dataport depending on your Data Storage (Maybe use ADO or a VIEW if you are on SQL).
  • cschriebercschrieber Member Posts: 15
    Thank you for the response. I haven't learned about temp records yet, but I'll take a look at those.

    Thanks again!
    Chad Schrieber
    Joyce Meyer Ministries
    Fenton, MO USA
    http://www.joycemeyer.org
Sign In or Register to comment.