Hello Everyone,
I was wondering if you can pass a temporary table to a dataport for export.
I have tried it by including the following line in a codeunit that contain a function that populates the temp table with the desired records;
DATAPORT.RUNMODAL(50066,TRUE,gtbUNIINSmallParcel);
but I get an error message when it tried to execute telling me that the dataport does not have a DataItem that uses the table specified in the function SetTableView.
The Dataport has the table listed in the dataitem and it is the same table the temp record is based on.
So why am I getting this error? Can this even be done? I am trying to do with through a temp table so that I do not have to create a new table that is similar to one that I have already created that has the fields that I need. I know that I can use variables in the dataport to include values contained in various tables, but that would mean that I would have to use coded logic to filter the records rather than true filters and therefore would have to scan the entire table everytime I run the report.
If remove the temp table from the RUNMODAL command there is no error (but the dataport uses the data that is in the table - Obviously).
Joe
P.S. I know that isn't the Canadian flag... I just thought I would use my Ethnic flag instead of my residence flag.
Answers
I would use an integer and variables to export
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
Thanks for the reply, but I don't understand what you are saying.
I guess that I should have mentioned that I am a Navision Newbie.
I thought I was passing the recordset in the RUNMODAL command.
gtbUNIINSmallParcel = the Temp Record that is populated in the Codeunit.
50066 = the Dataport.
The dataitem of your dataport must work on the virtual table integer. In the dataportfields, you have to put the fields of the temptable.
You need a function in your dataport to fill up the temptable. Something like:
In the OnPreDataItem-trigger:
In the OnBeforeExportRecord-trigger:
In the calling program:
Make a global variable for the dataport
For calling the dataport:
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I didn't know that you could set a DataItem entered as Integer and what that did. Once I figured that out, I realized that I could contain all the code and the temporay table within the dataport.
Joe 8)
You put the table on which your temptable is based in the dataitem with properties AutoSave,AutoUpdate,AutoReplace = No.
global:
tmpTheTable as TEMPORARY record
OnBeforeImportRecord-trigger:
OnAfterImportRecord-trigger:
This function must be called after launching the dataport:
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
[Changed the title from "[SOLVED] Passing a Temporary Record to a Dataport?" to "[SOLVED] Passing a Temporary Record to/from a Dataport?"]
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Thanks for your great Tip regarding "Import Data in Temporary Table through Dataport".
I have did the code as you have suggested for the same task.
I wrote one codeunit as below.
Where variables are:
LocationDtp-Dataport-Location
LocationListFrm-Form-Location List
LocationTmpTable-Record-Location-Temporary=yes.
Dataport "Location" with properties AutoSave,AutoUpdate,AutoReplace = No.
having code as:
Where variables are:
Parameters of ExportTempTable Function:
Var-Name-DataType-Subtype
Yes-OtmpTheTempTable-Record-Location
Global Variables:
Name-DataType-Subtype
LocTmp-Record-Location
LocationListFrm-Form-Location List
After I run the Codeunit, it is now viewing the Temporary Table Data in the form.
It is working fine now.
Thanks for sharing such a gr8 tip.
Ahmedabad, Gujarat, India
E Mail : ravi.thakkar@hotmail.com
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I am having an issue in the same method with the XML PORT in RTC.
ExportTempTable returns Blank table from the XML PORT.
I think XMLport does not run Modally, and that's why I am facing the issue.
Any suggestion regarding the same?
Ahmedabad, Gujarat, India
E Mail : ravi.thakkar@hotmail.com
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I did it while testing webservices and see where i can go
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog