How to Call Report after importing with Dataport

selece28
Member Posts: 316
Hi nav Masters,
I have a problems when importing using dataport then i call a report to print the record that i just imported.
I use a temptable on the dataport to fill in the data that is imported, then call a function in the report, the function is to fill the temp table in the report.
So now i have the same record in the dataport and in the report.
Then on the dataport i call the report with this code :
Dataport - OnPostDataport()
RptSalesPrice.gFn_SetRecord(RecTmpSalesPrice);
RptSalesPrice.USEREQUESTFORM(TRUE);
RptSalesPrice.RUN();
The Import data is success but it didn't call the Report?
What i want is to show the Report Request Form so i can preview or print.
Can i do that?
Please advice
Thanks in advance
I have a problems when importing using dataport then i call a report to print the record that i just imported.
I use a temptable on the dataport to fill in the data that is imported, then call a function in the report, the function is to fill the temp table in the report.
So now i have the same record in the dataport and in the report.
Then on the dataport i call the report with this code :
Dataport - OnPostDataport()
RptSalesPrice.gFn_SetRecord(RecTmpSalesPrice);
RptSalesPrice.USEREQUESTFORM(TRUE);
RptSalesPrice.RUN();
The Import data is success but it didn't call the Report?
What i want is to show the Report Request Form so i can preview or print.
Can i do that?
Please advice
Thanks in advance
______________
Regards,
Steven
Regards,
Steven
0
Answers
-
if you want to show request form when report run use
REPORT.RUNMODAL(Number [, ReqWindow] [, SystemPrinter] [, Record])
here u create a variable type record of same rec because if u pass rec in last parameter then it wont work.
saleshdr record sales header
saleshdr.setrange(saleshdr."No.","No.");
if saleshdr.findfirst then
report.runmodal(50000, ture, false, saleshdr);
hope it will help u.Experience Makes Man Perfect....
Rajesh Patel0 -
Hi rajpatelbca
I've try this before. Cannot use RUNMODAL because it will cause ERROR, i think its be cause the dataport haven't commit yet.
Any other idea?
thanks______________
Regards,
Steven0 -
Better is to have a function that calls the dataport, and then calls the report, rather than having the report called from the dataport.David Singleton0
-
Hi David,
Thats a good idea, but i want to know if navision can call report from dataport?
Thanks for the advice______________
Regards,
Steven0 -
u cant pass temporary table to a report to print from it.
Instead in your OnPostDataport trigger you could COMMIT changes and after that call the report with RUN.
Upon exit of OnPostDataport the COMMIT is issued by dataport itself so calling from a separate function your dataport and then your report essencially does the same thing0 -
Hi Eugene,
I already try to use COMMIT and then RUN, still cannot.
I think navision cannot call report from dataport, so i will try to find a workaround by calling from another function like David said.
Thanks______________
Regards,
Steven0 -
The better solution is: You call your Dataport from a form and after dataport is running u get back the TempTab and send this to the Report.
example:YourDataportAsVariable.runmodal; YourDataportAsVariable.GetTempTab(TempTab); <- CallByReference (VAR) YourReportAsVariable.SetTempTab(TempTab); YourReportAsVariable.runmodal;
RegardsDo you make it right, it works too!0 -
Yes thats a great idea, but it seems that i cannot get my TempTab.
I always get 0 record.
Any idea?______________
Regards,
Steven0 -
user message box to count record after importing data into table in dataport.
if records are avail in that time. then use var type parameter.
in a function called from fromExperience Makes Man Perfect....
Rajesh Patel0 -
selece28 wrote:Hi Eugene,
I already try to use COMMIT and then RUN, still cannot.
I think navision cannot call report from dataport, so i will try to find a workaround by calling from another function like David said.
Thanks
Change it from RUN to runmodal;0 -
I think when using RUNMODAL also cause an error.
Currently trying to do like this from codeunit
YourDataportAsVariable.runmodal;
YourDataportAsVariable.GetTempTab(TempTab); <- CallByReference (VAR)
YourReportAsVariable.SetTempTab(TempTab);
YourReportAsVariable.runmodal;
But i can't get my value even using CallByReference ](*,)
This is my code:gFn_GetImportedRecord(VAR Rec_TmpSalesPrice : TEMPORARY Record "Sales Price") Rec_TmpSalesPrice := gRec_TmpSalesPrice;
Its seems that my code must add InsertgFn_GetImportedRecord(VAR Rec_TmpSalesPrice : TEMPORARY Record "Sales Price") Rec_TmpSalesPrice := gRec_TmpSalesPrice; Rec_TmpSalesPrice.INSERT;
bu then problems when i have more than 1 record. Should i use looping or does Nav have a function to copy all records to another records?
Thanks in advance[/quote]______________
Regards,
Steven0 -
Thjis is the code in your Codeunit
CLEAR(YourDataport); CLEAR(YourReport); YourDataport.RUNMODAL; YourDataport.GetTempTab(VarTempTab); YourReport.SetTempTab(VarTempTab); YourReport.RUNMODAL;
This is the code in function GetTempTab in YourDataportGetTempTab(VAR VarTempTab : TEMPORARY Record "Customer Objects") IF TempTab.FIND('-') THEN BEGIN REPEAT VarTempTab := TempTab; VarTempTab.INSERT; UNTIL TempTab.NEXT = 0; END;
This is the code in function SetTempTab in YourReportSetTempTab(VAR VarTempTab : TEMPORARY Record "Customer Objects") IF VarTempTab.FIND('-') THEN BEGIN REPEAT TempTab := VarTempTab; TempTab.INSERT; UNTIL VarTempTab.NEXT = 0; END;
Now in report you loop through the TempTab, for example, in DataItem "Integer"
Do you need more informations :?:Do you make it right, it works too!0 -
Yes this is the solution,
Thanks garak.
I just find out that navision cannot do Rec := Rec1 without looping and INSERT.
My problem solved now,
Thank you all______________
Regards,
Steven0
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
- 320 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