Skip to main content
April 5, 2013
Answered

Second variable in CFQuery

  • April 5, 2013
  • 1 reply
  • 991 views

Doubt I've named this right...

Ok, here's what I'm trying to do:

I have a CFQuery set up:

<cfquery name="myQuery" datasource="someSource">

     SELECT DISTINCT

          item_num,

          item_name

     FROM table1

</cfquery>

I know this is working fine.  A little farther down my page I have a dropdown that gives a list of "item_name" entries.  What I want to do is set another variable to item_num based on whatever is chosen in that dropdown.  The item_name field is irrelevant to the rest of my page, it's just there to help out the end users with readability.

How do I do this?  It's kind of driving me nuts trying to figure it out.

This topic has been closed for replies.
Correct answer

To anyone else running into this issue:

I solved the issue by changing the value= field in the dropdown code to be item_num rather than item_name and adjusted how I set my item cfparam field.  Seems to work now.

1 reply

Inspiring
April 5, 2013

What kind of variable are you trying to set?

April 5, 2013

Something I can then pass on to my main data query when a refresh button (or Excel Export) button is pressed.  At first it will be 4 digit alphanumeric (if that matters).  I will be using it to limit the amount of data returned to that data for a specific item_name for a specific timeframe.

Timeframe part I have, just not how to do this part.

Correct answer
April 5, 2013

To anyone else running into this issue:

I solved the issue by changing the value= field in the dropdown code to be item_num rather than item_name and adjusted how I set my item cfparam field.  Seems to work now.