Question

The dumping results for the following QoQ are perfectly fine:

<cfquery datasource = "XX.XX.X.XX" name="master2">
   SELECT  DATE(Timedetail) as FIRSTCONN
           , count(Timedetail) as FIRSTOccurances
           , EVENTS 
   FROM    MyDatabase
   WHERE   EVENTS = "FIRST" GROUP BY FIRSTCONN 
<!--- LIMIT 0,10 --->;
</cfquery> 

<cfdump var="#master2#">

<cfquery dbtype="query" name="detail2">
    SELECT  *
    FROM    master2 
    WHERE   FIRSTCONN  >= <cfqueryparam value="#startdate#" cfsqltype="cf_sql_date"> 
    AND     FIRSTCONN  <  <cfqueryparam value="#enddate#" cfsqltype="cf_sql_date">;
</cfquery>  

Dumping Result: <cfdump var="#detail2#"><cfabort>

However, when I try to use the following check on the QoQ:

 Dumping Result: <cfdump var="#detail2.FIRSTCONN#"><cfabort>

I don't see the full list of FIRSTCONN values. Instead I just see one line:

  Dumping Result: {ts '2013-06-29 00:00:00'}

Ideally I should see the list of all the FIRSTCONN in my browser, shouldn't I?

Was it helpful?

Solution

You are looking at the default behaviour of coldfusion. When you output or dump queryname.fieldname, and don't specify a row number, you get the value from the first row. If you want to see all the rows, your choices are:

  1. Look at the value list
  2. Output/dump the entire query
  3. Do another q of q for just that column and cfdump it.
  4. Use cfoutput with a query attribute and just output that field

OTHER TIPS

If you are looking to produce the same structured output that cfdump produces when dumping a query, I have two suggestions:


My First Inclination:

<cfdump var="#ListToArray(ValueList(queryName.columnName))#" />

That one is obviously a, very, minor continuation on Dan's suggestion.


The second is available for CF 8+ and it is

Exactly What You Wanted:

<cfdump var="#queryName#" show="columnName"/>


You may specify either columns to display in the output via the show attributes or you can hide specific columns by assigning a value to the hide attribute.

CFAbort in CF Docs

Granted, this post is almost 18 months old but maybe this will help someone that stumbles onto this page.

This is a little off topic, but I'd like to point out that in my instance of CF2016 the cfdump function suppresses the output of columns (and makes them appear empty) that have lots of text in them (or have the option to have lots of text). I'm not sure if it's the nVarChar(max) setting of the table field or what, but in order to see the content of these big fields, I actually have to make a separate query that selects only this one field, and use a separate cfdump in order to see its contents. This is only for debugging purposes, but it will keep you from going crazy and rewriting your update and insert statements over and over (because they appear to not be working all the way)...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top