Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
dobaldwin #1
query1[query2.field] is incorrect
I'm trying to reference one query by the output of another. For example:
The output of query1.field is "first_name"
I want to somehow use this output of "query1.field" and use it in a reference,
like so:
query2."query1.field"
--or--
query2.first_name
I tried looking in documentation, etc, but I can't find any help on this
topic. I can do something similar with forms: FORM[query1.field] (which I
learned on macromedia forums), but can't seem to find a way to do it between
queries.
Am I asking too much? Is there another approach to this?
Please help.
dobaldwin Guest
-
Forms: Text field - auto fill another field?
Someone PLEASE help me... how do i structure a form so that when text is entered into one field, it auto-fills other fields on the form that are... -
Comparing current field data with last entry for field
Hi. I have a form that is inserting sales data on a daily basis. I have a field named "RoundTOTAL" which is the total sales for the day rounded to... -
Defined text field in form -> subject field in e-mail
Hi, I have a form on my web site which users send to me by mailto-function. I would like the text they write in a particular text field to... -
Linking date field to text field entry
Is there a way to setup a date field that will automatically enter the date when any information is entered into a field next to it? -
Curved Field vs Flat Field projector lenses
I was looking thru Adorama's page and came across two Kodak projector lenses. One was a 102/2.8 "Curved Lens" the other a 100/2.8 "Flat Lens" and... -
mxstu #2
Re: query1[query2.field] is incorrect
When using array notation for queries, you need to specify the query row number: query[columnname][rownumber]
<cfoutput query="query2">
#query2[query1.Field][currentRow]#<br>
</cfoutput>
mxstu Guest
-
dobaldwin #3
Re: query1[query2.field] is incorrect
Hm... still trying to get it to work correctly. This is what I have:
<cfloop query="query1">
#query1.field1#
<cfloop query="query2">
#query2[query1.Field][currentRow]#<br>
</cfloop>
</cfloop>
Isn't there anything like Javascript's Evaluate() function?
Again, thanks for the help!
dobaldwin Guest
-
dobaldwin #4
Re: query1[query2.field] is incorrect
I'm an idiot. My last post answered my own question. There is an Evaluate
function in ColdFusion. Here it is in action:
<cfloop query="query1">
#query1.field1#
#Evaluate("query2.#query1.field#")#
</cfloop>
Thanks everybody for putting up with me while I thought this one through.
dobaldwin Guest
-
mxstu #5
Re: query1[query2.field] is incorrect
Originally posted by: dobaldwin
There is an Evaluate function in ColdFusion ....
Yes, Evaluate() does work, but is not necessary here to get the job done. Try
and avoid using Evaluate() unless it is absolutely necessary, as it requires
more processing than a straight output. I'm not certain what information you
are trying to output, but if you are only need to output the first row in
"query2", the attached does the same thing without using Evaluate().
<cfoutput query="query1">
#query1.field#<br>
#query2[query1.Field][1]#<br>
</cfoutput>
mxstu Guest



Reply With Quote

