create temptable in dataport import, use in report
 
            
                
                    jversusj                
                
                    Member Posts: 489                
            
                        
            
                    I have checked the forums and found some similar threads, but they didn't really help me achieve my goal.
I am importing a text file into Navision that creates Sales Quotes. During the import, if the Item No. on the sales line is found to be invalid, i write a record to a temporary table I am calling error log. On PostDataItem, I call a report to print the error log. Trouble is, the tempTable doesn't seem to have any data in it when the report runs.
I tested physically writing the error log and then putting a DELETEALL in the report to purge the table, and this worked perfect, but is not the ideal solution.
One thread i found here suggested calling the report first, and from the report running the dataport, but i was having the same problem.
Is there a tutorial thread i did not find that discusses how to pass a temptable from a dataport import to a report?
flow:
import record.
If problem on import, write error log
finish import
call report to print the error log so user sees what problems exist and can address them.
                I am importing a text file into Navision that creates Sales Quotes. During the import, if the Item No. on the sales line is found to be invalid, i write a record to a temporary table I am calling error log. On PostDataItem, I call a report to print the error log. Trouble is, the tempTable doesn't seem to have any data in it when the report runs.
I tested physically writing the error log and then putting a DELETEALL in the report to purge the table, and this worked perfect, but is not the ideal solution.
One thread i found here suggested calling the report first, and from the report running the dataport, but i was having the same problem.
Is there a tutorial thread i did not find that discusses how to pass a temptable from a dataport import to a report?
flow:
import record.
If problem on import, write error log
finish import
call report to print the error log so user sees what problems exist and can address them.
kind of fell into this...
0                
            Answers
- 
            how are you calling the report?0
- 
            Tick Var in the parameter.0
- 
            here's how i call the reportInteger - OnPostDataItem() PrintErrorLog(); PrintErrorLog() COMMIT; //ErrorRpt.tmpError(ErrorLog); //testing an idea from another thread here REPORT.RUNMODAL(50060,FALSE); 
 Miklos, do I tick Var in the dataport function that calls the report, or in a function on the report?
 I'm currently experimenting with a function on the report (tmpError) that is accepting the temporary table, but after the function is done, the report closes and the output is never created... it never enters the dataitems.
 edit:
 I know the solution is somehow related to this thread i just found:
 http://www.mibuso.com/forum/viewtopic.php?t=12482&highlight=call+dataitem+function, but I am still having the trouble getting the dataitems to run... I get to my function and copy the temptable to a global on the report, but then it quits.[/url]kind of fell into this...0
- 
            Tick everywhere a temp table is passed as a parameter, I think.0
- 
            no luck.
 following through with the other thread's suggestions, here is what i have:REPORT Integer - OnPreDataItem() ErrorLog.RESET; SETRANGE(Number,1,ErrorLog.COUNT); Integer - OnAfterGetRecord() IF Number = 1 THEN ErrorLog.FIND('-') ELSE ErrorLog.NEXT; Integer - OnPostDataItem() tmpError(VAR XLog : Record "Error Log") ErrorLog.COPY(XLog);the function tmpError gets called from my dataport, and in debugger, I see it properly populate ErrorLog with the data from xLog, but then it leaves the function and returns to the dataport, where the runmodal is called. Then the report initializes an empty error log table...
 Is there a way to call a report function, but when the function is done, go to the dataitems of the report instead of back to the dataport? If I could just get into the report dataitems i think i could crack this. thanks in advance!kind of fell into this...0
- 
            OK some clarification:
 - in the dataport, somewhere at the end loop through the template and call the function in the report for each record
 - in the function of the report, insert the VAR record received as a parameter into a global temp table
 it should work, because as long as the report object variable is in scope and it has a global temptable populated it won't lose it just because the code goes back to the dataport0
- 
            Hello,
 I have followed Miklos helpful suggestion, neglecting to make the destination table temporary in the report. so, the first time i ran the import, everything went well (although i took the temp data and turned it into physical data).
 I ran it a second time and saw the same errors from the first time, plus some new. I realized I forgot to change the destination table to temporary. I made the change (deleting the records in the table as well) and re-ran the process.
 I got an error that the table was empty.
 I watched the process through debugger and saw the following:
 my loop in the dataport to pass the temp table (XLog) to the report function, where it writes the same record to another temp table (ErrorLog). This all appears to go smoothly.
 After completing the loop, the RUNMODAL was called, and the report came up with the temptable ErrorLog uninitialized (? - i just populated it). Of course, it initializes with no records and my FIND fails.
 Any ideas why I might be having this problem?kind of fell into this...0
- 
            i'm dumb.
 i was using 2 different syntax, so i was calling two different instances of the report - hence the uninitiated record. i corrected my syntax and POW! everything worked great.
 Thanks Miklos and everyone else in the other thread for getting me on the right track.kind of fell into this...0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 322 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

