I need help quickly on Dataports PLEASE

I have a dataport defined for a table 50136 Query Results. This is my temp table I use to return results for SQL queries, etc. Most of the time I instantiate this table as a temp table variable and write records to it on the fly that I don’t save such as a list of SQL Servers or DTS Package results, or the results of some other on the fly queries. On the form I use to present these results, I want the user to be able to export those temp results to a text file, so I have the dataport as a variable (ExportResults) on the form and the following code on a button: ExportResults.SETTABLEVIEW(Rec); ExportResults.RUN; I get the following: The SQL Results Out Dataport does not have a dataitem that uses table (50136 SQL Query Results)specified in the SetTableView I also tried: Dataport.RUN(50052,True,Rec); Same error The record set I am passing is the same definition as the dataport record set so I dont understand the message I don’t know why this will not work, if someone could please help me I would be very grateful, this is the last thing of a really important project I am trying to finish Thanks

Hi Devin I have had the same problem with temp records into a dataport, I still don’t know the answer, but would like to know the reason why. My work around was to write code to write to an external text file on the button OnPush trigger, with a dialog.Input requesting a file name and path.

Devin, If you are holding the data you want to export to a text file in a temporary instance of a table why not iterate through the temp table while outputing to a file directly using the FILE or OUTSTREAM + FILE variable combination. If the dataport doesn’t work with a temp table as Stephen suggests, you don’t have to use a dataport to create your text file. I hope this helps, Chris.

I did not think it possible to run a Dataport with a temp table, but it may be. Try the follwing. I have NOT tried it, and am just guessing, but please let me know if it works.ExportResults.SETTABLEVIEW(Rec); ExportResults.**RUNMODAL**;

If that does not work, try creating a Function in the Dataport ot upload the TempRecord, and then on the OnBeforeExport Trigger copy the temp rec accross. Something like if TempRec.next = 0 then break DatportRec.cop(temprec) etc.

By the way, why not just create a SQL view, and let the users pull the data themselves.

David - 3 answers in 3 minutes surely that isnt another attempt to boost yourself to the mythical 5 star status.[:D]

No it wasn’t, but this is…

You can use same procedure to print temporary tables: create a function like: GetValues(LRec) grec.deleteall; if lrec.find(’-’) then repeat grec.transferfields(lrec); grec.insert; until lrec.next = 0; and export via integer dataitem best regards from bcn. Salut!