Adobe Dreamweaver Forums



Last 10 THreads :         Re: 2.1 GB TIF size limit (Last Post : Bart_Kelsey@adobeforums.com - Replies : 0 - Views : 1 )           »          Strip EXIF camera data from PSD files? (Last Post : Ho - Replies : 3 - Views : 8 )           »          delete all channels previously created by "save selection" (Last Post : Paul_R@adobeforums.com - Replies : 4 - Views : 5 )           »          flash drawing (Last Post : ponarangan - Replies : 0 - Views : 1 )           »          Flash IDE randomly creating Symbols (Last Post : OLTLfan - Replies : 2 - Views : 4 )           »          Can I make a 4 state CSS Sprite nav bar. (Last Post : Dooza - Replies : 9 - Views : 10 )           »          JavaScript to enable submit button (Last Post : Dooza - Replies : 8 - Views : 9 )           »          Webhelp Instead of HTML Help for Desktop Applications? (Last Post : Peter Grainge - Replies : 1 - Views : 2 )           »          Help With a earth spinn flash site (Last Post : Balambur - Replies : 0 - Views : 1 )           »          pause imported swf when Captivate movie is paused (Last Post : j-wa - Replies : 0 - Views : 1 )           »         


Mission Statement
DreamWeaverForum.infois an online Community of web developers joining together to better their field, share problems and solutions as well as promoting their cause.
We strive to bring you the best information, tools, downloads and news to support your work and companys efforts working in web development.
With our favorite tool "Dreamweaver" and the tools and information we bring you, You should be in a great postion to better your skills and show the world your work.
Come back often, Stay late we have many new things coming your way. Wish you all the best in 2009 information..



 



User Info Statistics
Go Back   Adobe Dreamweaver Forums > Macromedia Software > Cold Fusion > Reporting
 
Tags:



Reply
  #1 (permalink)  
Old 11-04-2008, 09:22 AM
jergarmar
 
Posts: n/a
Diggs:
Default using advanced query builder for a chart

I am trying to insert a query-based chart in my report template. However, the
data is coming from a text file; thus I am creating the query object for the
chart by parsing the text file. However, the "query.name" and "query.number"
fields are not changing for each record from the original report query -- only
the first record is used. Thus the first chart on the first page is correct,
but the chart never changes for all the other pages (each page represents one
record from the query). This is what I'm putting into the advanced query
builder :

<cfset ThisQuery = QueryNew("ItemColumn,ValueColumn")>
<cfif FileExists("D:\charts\#query.name#_#query.number#. txt")>
<cfset ThisDataItem = 0>
<cfloop file="D:\charts\#query.name#_#query.number#.txt" index="ThisLine">
<cfif IsNumeric(ThisLine)>
<cfset ThisDataItem += 1>
<cfset QueryAddRow(ThisQuery)>
<cfset QuerySetCell(ThisQuery,"ItemColumn",ThisDataItem)>
<cfset QuerySetCell(ThisQuery,"ValueColumn",ThisLine)>
</cfif>
</cfloop>
</cfif>

So basically the filename is set according to first row (result) from the
report query, but then the filename (and thus the chart) never changes even
though all the other query-based fields on my page change properly (all the
other query.BlahBlah fields update correctly). Is this a bug? I didn't think I
was doing anything too crazy.



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-04-2008, 09:22 AM
jergarmar
 
Posts: n/a
Diggs:
Default Re: using advanced query builder for a chart

Whew! I figured out a really awesome solution, which has a ton of uses.

First of all, as I should have realized, ANY variable in a coldfusion tag is
going to be figured out when the report is called, NOT for every query result.
In other words, query.xxx or report.xxx or whatever is NEVER going to work
correctly inside of a tag, not even in a report function or the Advanced Query
builder.

However, there is a straightforward way around this. Simply make a report
function with arguments, and in your field's expression editor call the
function and pass in the query or report variables:
#report.yourFunction(query.field1, query.field2)#
You can do all sorts of Coldfusion function magic and return whatever form of
result you want.

For my particular example (dynamically creating a query object for a chart to
be inserted), I had to add a not-so-obvious step: creating my query object with
a shared scope (in this case, the Request scope), otherwise the variable is
trapped in the function's scope. So this was my solution: I had a chart with
the "Print When" option calling my function "getChartQuery" (passing in the
query variables, of course). The function builds "Request.ThisChartQuery" and
returns True if there's something in it (the "Print When" logic uses the
boolean to decide whether to show the chart or not). Then my chart is still
query-based, but the Advanced Query builder has NOTHING in it at all, except
for the variable containing the query object ("Request.ThisChartQuery").

There was another solution I found where the report function makes the entire
chart (using cfchart tags, etc) and saves it as a PNG file, and then returns
the path to the image. Then you simply add an image field to the report, and
you use the expression builder to call the function. Well, hope this helped
someone!

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 09:25 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk