Temp. Data to a Report

stony
Member Posts: 122
Hello,
i have in a form (source is item), a variable TempItem (is a temp. variable - record - item), which will be filled with same items records. Now, i want to start a report, which will use only this TempItem Records. (with the FlowFields "Qty. on Sales Order" to the DateFilter)
This is the code to start the report (OnRun-Trigger by a Button)
But this did not work right. What is wrong. How can i transfer the TempItem to the report?
regards
stony
i have in a form (source is item), a variable TempItem (is a temp. variable - record - item), which will be filled with same items records. Now, i want to start a report, which will use only this TempItem Records. (with the FlowFields "Qty. on Sales Order" to the DateFilter)
This is the code to start the report (OnRun-Trigger by a Button)
SelectItem := TempItem; SelectItem.COPYFILTERS(TempItem); REPORT.RUN(50073,TRUE,FALSE,SelectItem);The Report have as DataItem "Item" and "Sales Line".
But this did not work right. What is wrong. How can i transfer the TempItem to the report?
regards
stony
0
Comments
-
Search the forum for "Parameter report" and you will find examples like
viewtopic.php?f=23&t=42803&hilit=parameter+reportCA Sandeep Singla
http://ssdynamics.co.in0 -
0
-
why are you not using directly the TempItem when calling the report?0
-
Do you mean ?
REPORT.RUN(50073,TRUE,FALSE,TempItem);
0 -
As you have mentioned flowfiled,one thing is also keep in mind value of flow filed does not calculated in TempTable.0
-
stony wrote:Do you mean ?
REPORT.RUN(50073,TRUE,FALSE,TempItem);
Better will be something like:REPORT.RUN(REPORT::"50073",TRUE,FALSE,TempItem);
(but it is only the "purity" of the coding)
But yes, try it...0 -
I think that it depends on specific version, but may be I am wrong, I have not used it long time...0
-
i just tried it...i'm too curious
in nav 2009 sp1 this codetbcustomer.findfirst; tempcustomer := tbcustomer; tempcustomer.insert; report.run(report::"Customer - List",false,false,tempcustomer);
returns this error...The Customer - List report does not have a DataItem that uses the table (Table 18 Customer) specified in the function SetTableView.0 -
Ah,ok, than, I am wrong...
It is the error that table is not there but it is... I think that it was same for XMLPort in NAV 4 but was solved for it in NAV 5+ and may be I remember this one...0 -
I just recently went through this exercise. Here's what I did.
I used a form that was bound to a table with the "SourceTableTemporary" property set to Yes. My form fills the temporary table with data. When I want to launch a report based on the temporary data, I execute this code from within the form:
CLEAR(SalesRep);
SalesRep.PassParams(Rec);
SalesRep.RUN
"SalesRep" is a variable that is type "Report", set to the report I wish to run.
In the report, I added a function called "PassParams" with one pass-by-reference parameter (i.e. the VAR column is checked) of type "Record" which points to the same table that the form is bound to. The function looks like this:
PassParams(VAR TempSales : Record "Sales Report Worksheet")
SalesRec.COPY(TempSales,TRUE);
"SalesRec" is a global variable of type "Record" that is set to the table that the form is bound to. Its "Temporary" property is set to Yes. The one line of code is key as it tells Navision to reference the temporary table (and thus all of its data) that was passed (by reference also) from the Form. So in the report, "SalesRec" is actually referencing the temporary table that was created (and still held) by the form.
The report must use the Integer table as the data item and the temporary records must be looped manually. To do this place this code at the beginning of the "Integer - OnAfterGetRecord()" trigger:
IF Counter = 0 THEN
SalesRec.FINDFIRST
ELSE
SalesRec.NEXT;
Counter += 1;
"Counter" is a global variable of type integer. Finally, place this code in the "Integer - OnPreDataItem()" trigger:
SETRANGE(Number,1,SalesRec.COUNT);
Counter := 0;
Otherwise, the report will run for as long as there are integers in the Integer table. Also, each field used in the report "sections" will have to be prefixed with the temporary table variable name (SalesRep in my example above), since these fields won't exist in the Integer table.0 -
Flowerbiz, you're making harder a simple thing :-k
why do you need a form with temporary sourcetable and pass the parameters to the report?
you can just populate the temptable within the report dataitems, and then show the integers! (just like it's done in the howto)0 -
Belias wrote:Flowerbiz, you're making harder a simple thing :-k
why do you need a form with temporary sourcetable and pass the parameters to the report?
you can just populate the temptable within the report dataitems, and then show the integers! (just like it's done in the howto)
I agree with you but the original poster was asking to launch a report from within a form, using a temporary table.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
- 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