Skip to main content
Known Participant
March 11, 2010
Question

Run sequential queries on one button click

  • March 11, 2010
  • 1 reply
  • 1381 views

Hello, I hope you can help me.

I have to export to excel, 20 or so queries.

What I would like to do is set the date range on a form, and then click Submit.  The submit would perform about 20 queries, one of the other and writing EACH to its own excel file.  Is this possible?

The queries are exactly the same, except for one WHERE clause.  I can pre-write the queries, all 20 of them, but how I do make them begin after the previous ends?  And what would be the best way to have these write to a file upon completion?

Thanks guys

    This topic has been closed for replies.

    1 reply

    Fernis
    Inspiring
    March 13, 2010

    ColdFusion executes all statements in .cfm template, including queries, in sequential order (with some exceptions like cfexecute with certain attributes).

    Thus, your question does not make sense to me. Can you specify a bit further?

    -Fernis

    depth10Author
    Known Participant
    March 13, 2010

    But can you have it save the query data to file after each query is

    run, all on the same page? Would you just have a separate for

    each?

    Fernis
    Inspiring
    March 13, 2010

    I don't see how - for example - using cfspreadsheet tag to save a query to a file is any different from, say, setting a variable with a value. If you do <cfset a = 1>, you certainly don't need a new .cfm page to set <cfset b = 2>. Similarly, writing many files from many queries on the same page is something you could logically do with any language or any middleware.

    I must be missing something here, since I can't see how this is a problem...

    It should be pretty easy to have a loop, and parameterize both filenames and cfquery data.

    Maybe if you post some code example or detailed expalanation about how and what you want to do, people can help you further.

    -Fernis