Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Download a Query

    I manage a database on a website using Coldfusion. Several people use this and
    I want to give them the ability to get whatever data they want and download it
    to their own computers so they can work with it in Excel, for example.

    It would be nice if I could give them the choice of what fields to download,
    but just 'dumping' an entire table would be OK. I don't even know where to
    start. Any guidance would be appreciated.

    Thanx
    Chris


    RV Chris Guest

  2. Similar Questions and Discussions

    1. Unable to download trial, download pulled?
      I've tried downloading the Adobe Contribute CS3 trial version for windows for a few days now, and I've already sent a message using the Adobe...
    2. Download query results to Excel file
      Hello, I am trying to create this reporting tool - where users can select the criteria and generate a montly report - which I wanted them to...
    3. Query of Queries on query New type query
      In CF5 we have a page that creates a query, using queryNew and querySetCell and the like, we then used dbtype="query" and gave it's name so we could...
    4. #25471 [Opn->Bgs]: The PHP Documentation download page does not show any download
      ID: 25471 Updated by: derick@php.net Reported By: mahesh dot chandrasekar at icici-infotech dot com -Status: ...
    5. #25471 [NEW]: The PHP Documentation download page does not show any download in Mozilla
      From: mahesh dot chandrasekar at icici-infotech dot com Operating system: All PHP version: Irrelevant PHP Bug Type: *General...
  3. #2

    Default Re: Download a Query

    simple... select 'field1, field2, field3' AS catz from that_table <cfoutput>
    #catz# </cfoutput> to output specific fields, form page could select fields as
    same input name which would post to query as comma deliminated list of form
    fields <input type='checkbox' name='fields' value='field1'>field1 <input
    type='checkbox' name='fields' value='field2'>field2 select #fields# from
    that_table

    ranger Guest

  4. #3

    Default Re: Download a Query

    When I try that I get an error about Complex object types cannot be converted
    to simple values.
    Also, I want the user to be able to download the data to a comma delimited
    file on their own computers.
    ??

    RV Chris Guest

  5. #4

    Default Re: Download a Query

    Hi Chris, Look up CFCONTENT.

    Using the CFEXAMPLES database:

    <Cfquery name="getdata" datasource="sql">
    select top 10 * from Customers</CFQUERY>
    <cfset content="">
    <cfloop index="thisfield" list="#getdata.columnlist#">
    <cfset content=content&thisfield&chr(9)>
    </cfloop>
    <cfset content=mid(content,1,len(content)-1)&chr(13)>
    <Cfoutput query="getdata">
    <cfloop index="thisfield" list="#getdata.columnlist#">
    <Cfset content=content&evaluate(thisfield)&chr(9)>
    </cfloop>
    <cfset content=mid(content,1,len(content)-1)&chr(13)>
    </cfoutput>

    <cfcontent type="application/vnd.ms-excel"><cfoutput>#content#</cfoutput>

    philh Guest

  6. #5

    Default Re: Download a Query

    RV Chris

    Are any of your database columns variable scope names eg SERVER, URL, FORM
    because that is usually what gives the error about complex data types you got
    above. You might need to do a bit of a rename of columns before displaying them
    *shrugs*

    HTH

    zoeski80 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139