Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

New records transfer issue from one table to another

Posted on by Microsoft Employee

Hi,

Any one can help ?

using Navision 2016 CU 24 application .

designed two table with ID 50130 and ID 50131

Navision database is SQL 2014 std SP2(service pack 2)

create link server in Navison in SQL 2014 with another  SQL 2008 R2 

and used the ADO connection to import data from SQL 2008 table to Navision table  by using code unit ( running through JOB que entries)

lADOConnection.Open;

lVarConnection := lADOConnection;
lADOCommand := lADOCommand.OdbcCommand();
lADOCommand.CommandTimeout(0);

Table ID 50130 upadated regularly without any issue.

in next step trying to copy data from Navision table ID 50130 to 50131 , using another code unit (running through JOB que entries)

OnRun()

Frecordinsert();         ///Function created to insert data from Table 50130 to 50131

LOCAL Frecordinsert()
CLEAR(CMS_EXP_TRA);                ////  CMS_EXP_TRA  is a record of table ID 50130
RecCMSEXPTRA.RESET;               ///  RecCMSEXPTRA  is a record of table ID 50130
IF RecCMSEXPTRA.FINDFIRST THEN REPEAT
//CMS_EXP_TRA.RESET;
CMS_EXP_TRA.SETRANGE(CMS_EXP_TRA.EntryNo,RecCMSEXPTRA.EntryNo);
IF CMS_EXP_TRA.FINDFIRST THEN BEGIN
CMS_EXP_TRA.GenJour:= TRUE;
CMS_EXP_TRA.MODIFY;

END;
UNTIL RecCMSEXPTRA.NEXT=0;

////////////////////////////////////////////

GCMS_EXP_TRA1.RESET;                             ////  GCMS_EXP_TRA1  is a record of table ID 50130

IF GCMS_EXP_TRA1.FIND('-') THEN      
REPEAT
GCMS_EXP_INT_TRA.INIT;                           /////GCMS_EXP_INT_TRA  is a record of table ID 50131
GCMS_EXP_INT_TRA.VALIDATE(EntryNo,GCMS_EXP_TRA1.EntryNo);
GCMS_EXP_INT_TRA.VALIDATE(DocumentNo,GCMS_EXP_TRA1.DocumentNo);
GCMS_EXP_INT_TRA.JournalTempName:='GENERAL';
GCMS_EXP_INT_TRA.JournalBatchName:='INTERFACE';
GCMS_EXP_INT_TRA.SourceCode:='CASHRECJNL';
GCMS_EXP_INT_TRA.VALIDATE(LineNo,GCMS_EXP_TRA1.LineNo);
GCMS_EXP_INT_TRA.VALIDATE(AccountNo,GCMS_EXP_TRA1.AccountNo);
GCMS_EXP_INT_TRA.VALIDATE(PostingDate,GCMS_EXP_TRA1.PostingDate);
GCMS_EXP_INT_TRA.VALIDATE(DocumentType,GCMS_EXP_TRA1.DocumentType);
GCMS_EXP_INT_TRA.VALIDATE(BalAccountNo,GCMS_EXP_TRA1.BalAccountNo);
GCMS_EXP_INT_TRA.VALIDATE(ExternalDOC,GCMS_EXP_TRA1.ExternalDOC);
GCMS_EXP_INT_TRA.VALIDATE(Amount,GCMS_EXP_TRA1.Amount);
GCMS_EXP_INT_TRA.VALIDATE(SBUCode,GCMS_EXP_TRA1.SBUCode);
GCMS_EXP_INT_TRA.VALIDATE(CenterCode,GCMS_EXP_TRA1.CenterCode);
GCMS_EXP_INT_TRA.VALIDATE(EMPLOYEECODE,GCMS_EXP_TRA1.EMPLOYEECODE);
GCMS_EXP_INT_TRA.VALIDATE(LocationCode,GCMS_EXP_TRA1.LocationCode);
GCMS_EXP_INT_TRA.VALIDATE(StateCode,GCMS_EXP_TRA1.StateCode);
GCMS_EXP_INT_TRA.GenJour:=FALSE;
GCMS_EXP_INT_TRA.GenLed:=FALSE;
IF GCMS_EXP_INT_TRA.INSERT THEN;
UNTIL GCMS_EXP_TRA1.NEXT=0;

job que entry executed without any error.

any new record are coming from SQL 2008 R2 to Table 50130  not inserting automatically in Table ID 50131

if run the Code unit manually then it inserted without any issue in Table ID 50131

Please help 

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: New records transfer issue from one table to another

    MODIFYALL  function   is the perfect answer of above query

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: New records transfer issue from one table to another

    I mean NAV server not DB server, anyhow is your codeunit set as Single Instance ? One easy way is debug your Job Queue sessions and check if it stepping through your code or not.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: New records transfer issue from one table to another

    Dear Mr Skkulla,

    yes running the codeunit  (job que )in database server only.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: New records transfer issue from one table to another

    Dear Stefano,

    thanks for suggestion. NAS  configured correctly , because other job entries are running with the same setup and related job que entry setup is also correct.

    Reason: If 10 records are available in table 1

                 1. Rum the code unit manually , all 10 records copied from table 1 to table 2

                  2. deleted the all 10 records in table2

                  3. one more records add in table 1 now total records are 11

                  4. now run the job que  

                   5. Table 2 allow only 10 record, 1 is pending to insert in table 2.

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: New records transfer issue from one table to another

    Did you run the codeunit on the server or from your local machine, can you run the codeunit from the server and see if you get any errors?

  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: New records transfer issue from one table to another

    Is the NAS correctly configured and running? Have you checked this? Are there error logs in the Job task? Is the ADO component installed on the server?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans