Temporary Table Validation

JAYESHJAYESH Member Posts: 290
Hi all,

I am tring to insert records in the sales header and sales line table. I define this two table as temporary table on property.

The main purpose in my program is to validate all fields which I am inserting in this tables.
Program is not validating any fields when i am inserting records in this tables.

Can any one tell me what I am doing wrong ?
JAYESH PATEL

Answers

  • kinekine Member Posts: 12,562
    Calling VALIDATE or other triggers over temporary table is not recommanded, because this process can make changes in another tables and this can be big side-effect you do not want. Do not forget that. [-X
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • JAYESHJAYESH Member Posts: 290
    My problem is,

    When I am trying to insert records in the sales line table some times I got error, data is not validate. I am inserting sales Header records first and then sales line records.

    What my porblem is, Sales header table is already used next no in no.series. I dont want to skip that invoice no. that's why I am tring to insert records in temp table then if everying works fine, its insert records in sales header and line table.

    Do you have any other ideas ?
    JAYESH PATEL
  • SavatageSavatage Member Posts: 7,142
    sounds to me you need to provide more info.
    Are you using a dataport?
    If so why can't you validate there?

    How are you matching sales lines & headers?
    does the sales lines know the correct document #?
    what exactly is the error you get?
  • kinekine Member Posts: 12,562
    JAYESH wrote:
    My problem is,

    When I am trying to insert records in the sales line table some times I got error, data is not validate. I am inserting sales Header records first and then sales line records.

    What my porblem is, Sales header table is already used next no in no.series. I dont want to skip that invoice no. that's why I am tring to insert records in temp table then if everying works fine, its insert records in sales header and line table.

    Do you have any other ideas ?
    If you take some no. and in same transaction is some error, the no. series will not be changed. If it is, there is some COMMIT in the transaction and this is your problem. You need to do all as one transaction. Than in cae of error all is rolled back to previous state and you do not have this problem.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • garakgarak Member Posts: 3,263
    Don't use TempRecord.validate(field,value), TempRecord.insert(true) if there is a No Series or other tables updated, TempREc.rename(), TemRec.modify(true), TempRec.delete(true) if there are other tables updated in these triggers. Also be sure, if you call functions in your temptable, that these function doesn't update other recs in other tables.

    Search also the forum for temporary table and validate

    Regards
    Do you make it right, it works too!
  • JAYESHJAYESH Member Posts: 290
    Thanks for the Information.
    JAYESH PATEL
Sign In or Register to comment.