Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7552401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:45:14+00:00 2026-05-30T10:45:14+00:00

We have created one temp-table dynamically . and we want to out put the

  • 0

We have created one temp-table dynamically . and we want to out put the complete table into a .csv file. how to do?

DEF VAR ttH AS HANDLE NO-UNDO.
ttH:CREATE-LIKE(hBuffer).
ttH:Temp-table-prepare("tmytable")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:45:15+00:00Added an answer on May 30, 2026 at 10:45 am

    Because you created your temp-table dynamically, you cannot use the EXPORT statement (at least to my knowledge). What you can do though is dynamically output first the fieldnames and then the field values of your table. Like so:

    DEFINE VARIABLE hQuery  AS HANDLE NO-UNDO.
    DEFINE VARIABLE ttH     AS HANDLE NO-UNDO.
    
    /* Define a new output stream  */
    DEFINE STREAM s1.
    OUTPUT stream s1 to "myCSV.csv".
    
    /* Create a query for the contents of your temp-table */
    CREATE QUERY hQuery.
    /* Important: we need to use the temp-tables default buffer handle, 
    /* not the hBuffer handle to the original table! */
    hQuery:SET-BUFFERS (ttH:DEFAULT-BUFFER-HANDLE).
    /* Use the name you created before for the FOR EACH clause */
    hQuery:QUERY-PREPARE("FOR EACH tmytable").
    hQuery:QUERY-OPEN().
    hQuery:GET-FIRST().
    
    /* Write out the names of the fields as header in the first row */
    DEFINE VARIABLE i AS INTEGER NO-UNDO.
    DO i = 1 TO ttH:DEFAULT-BUFFER-HANDLE:NUM-FIELDS:
        PUT STREAM s1 UNFORMATTED ttH:DEFAULT-BUFFER-HANDLE:buffer-field(i):name + ",".
    END.
    PUT STREAM s1 UNFORMATTED SKIP.
    
    /* Walk through the query and output each field seperately. */
    REPEAT:  
        hQuery:GET-NEXT().  
        IF hQuery:QUERY-OFF-END THEN LEAVE.  
    
        DO i = 1 TO ttH:DEFAULT-BUFFER-HANDLE:NUM-FIELDS:
            PUT STREAM s1 UNFORMATTED ttH:DEFAULT-BUFFER-HANDLE:buffer-field(i):buffer-value ",".
        END.
        PUT STREAM s1 UNFORMATTED SKIP.
    END.
    
    OUTPUT stream s1 close.
    

    Just note that this might not perform for large quantities of table entries!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a temp table created from a copy from a CSV file and
I have creted one dynamic temp-table and dynamic query.Now I want to populate it
I have created one table using the below command: create table Table1( Id int
I have created two JavaScript files. One file is "validators.js" and the other is
I have 2 procedures. One that builds a temp table and another (or several
I have one binary file which I have created. In it, data is stored
I have a table whose NSTableColumns are created dynamically in code. I need to
I created two temp tables, one table is for orders and the other is
I have created one aspx Page from that i need to access the property
I have created one application in flex that is accessing the Java webservice using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.