Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting tables?

Status
Not open for further replies.

lemonjuice

Programmer
Jun 12, 2003
62
ZA
I want to allow the user to create a backup by exporting all the files of the application to the selected destination. When I try to do this I can only select a single table from the the Export <tableName> As dialog box. How do I export all the tables at once to the selected directory?
 
lemonjuice,

You need to do this with ObjectPAL. Here's one way to do it:

Code:
method pushButton(var eventInfo Event)
var
   astrTables    Array[] String
   siCounter     SmallInt
   strFilename   String
endVar

   enumDataBaseTables( astrTables, &quot;:work:&quot;, &quot;*.db&quot; )
   for siCounter from 1 to astrTables.size()

      ; update the user on progress
      Message( &quot;Exporting Table &quot;, siCounter,
               &quot; of &quot;, astrTables.size(), &quot;...&quot; )

      ; extract the filename
      strFilename = astrTables[ siCounter ]
      strFilename =
         strFilename.substr( 1,
            strFilename.search( &quot;.&quot; ) - 1 )

      ; export the table
      exportASCIIVar( astrTables[ siCounter ],
                      strFilename + &quot;.txt&quot; )

   endFor
   beep()
   Message( &quot;All tables exported...&quot; )

endMethod

Now, this version exports the DB's to TXT files of the same name in the same directory, assumes your tables are in :WORK:, and contains very little error-checking. You'll want to beef this up for a production application, but it should serve as a starting place.

Hope this helps...

-- Lance
 
I need to export a table with tab sets (which would be ascivar). The problem comes when I read out of my file and save to the clipboard, I lose the formatting. I've tried formatting my file, but it loses the formatting when the export is called again. I can't figure out how to use the rtf. readfromrtf always fails. Ultimately I want the user to insert from the clipboard a perfectly formatted table (now just formatted text). HELP! Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top