10 Replies Latest reply on May 8, 2009 6:28 AM by WarmFront

    How can I set a variable from a computed value in a query?


      I'm trying to use a computed columns value from a query to set a variable.
      Here is the query:
          <cfquery name="qhiRole_OwnIHSArea" datasource="#at_datasource#">
          SELECT max (fk_JobUser_Role)
          from Job_DelgtAreaRole
          WHERE IHSUID = #qJobUser.IHSUID# and IHSAreaAssignedID = #qJobUserArea.JOBIHSArea_ID#


      I dumped the query and got the value I wanted as "computed_column_1.


      Then I tried this: <cfset userRole = #qhiRole_OwnIHSArea.computed_column_1# />
      The error message said "computed_column_1" was undefined.
      I tried changing the query to "Select max (fk_JobUser_Role) as theRole
      but that was "undefined", too.


      Any way to grab the result of the query to set a variable afterwards?