Updating Multiple Table in Nav 5.0


I am new to Navision. Require some help, hope wil find some kind of solution.

I’ve require one code unit to extract text from a text file and inserting the data into the respective table, which is triggered when a button is clicked.

The challenge am facing is when the user clicks on update button once the data gets inserted properly, but when the user again clicks on the button, the duplicate record should get updated. Do remember the text in a file is inserted in two or more table, so if user again wants to update(run the code unit again), the both the table must get updated.

Please help.

You need to check whether same data is already there in Table and If found then just ignore it and insert only those record which is not there in table


You can delete the records and insert it again in table.

I think i got the solution to some extent and may get clear solution, if i explain you in detail.

I will take two tables of mine, i.e Item table table and price list table.

  1. Item table is having primary key column “serial no.” and unique column “item no.” . price list is having a combination of 4 column as primary key column (item no, entry date, …).
  2. in a text file, ther is a data like this: “item1”, “item2”, “item3”…
  3. i want to insert first 15 text. i.e from “item1” to “item15” into item table and last 10 text into price list table.
  4. if the data is repeating, means duplicate data, then the data must get replaced, but the primary key should remain same.

i’ve written the code unit, but its inserting new record and makin duplicate entry in it. when i set table constraint, the price list table throws error. i need an idea of how to make such entry and maintain data integrity and avoid redundancy

“…when i set table constraint…”

Some of the terminology you are using makes me think you are creatign or modifying your table definition directly in SQL. Are you? If not can you clarify what you are doign in Object Designer terms?

i do not know how to explain in Object designer term. But, am not doing anything in SQL. I’ve created one table in Navision 5.0. When i set the primary key “constraint”(I guess i’ve used wrong term here), i am not able to insert data into price list table. This is b’coz, i guess, duplicate entry. but even m not able to modiy the data too.

Hi Pranav,

Did you get an answer to your question? Did it help you? The members and moderators here on DUG use our spare time and help you for free, all we ask in return is that you spent a few seconds to let us know if we helped you solve your problem.

If any of the suggestions helped you solve your question/problem, then please click the “Verify Solution” on the answer that helped you, so that we can see that your problem is now “resolved”. Otherwise let us know how if there is something else you like to know.

Have a nice day! [:)]