CFOUTPUT Query variable name doesn't work on CF11 Linux

New Here ,
Aug 28, 2015 Aug 28, 2015

Copy link to clipboard

Copied

I am trying to reference a query from a struct and use it in other cfm files but I get this error message from CF11 Linux:"Attribute validation error for tag cfoutput. The value of the attribute query, which is currently Application.SRS.RequestTypes, is invalid.'

It works on CF9 window server.

Here are the code:

<!--- entry-sr.cfm

    <script type="text/javascript">

        function setTypeDesc( request_type ) {

          <CFOutput Query="Application.SRS.RequestTypes">

            if ( request_type == "#request_type_code#" ) {

              document.getElementById( "TypeDesc" ).innerHTML = "#JSStringFormat( request_type_desc )#";

            }

          </CFOutput>

          if ( request_type == "A" ) {

            document.getElementById( "Developer_Label" ).className = "req";

            this.form.Developer.value = '#UCase( Request.LogonID )#';

            this.form.Developer.onblur();

          } else {

            document.getElementById( "Developer_Label" ).className = "";

          }

        }

      </script>

load-type.cfm: query statement

   

    <CFQuery Name="RequestTypes" DataSource="#Application.SRS.AppDataSource#" BlockFactor="100">

        SELECT

        FROM srs_type

        ORDER BY request_type_code

    </CFQuery>

    <CFLock Timeout="60" ThrowOnTimeout="Yes" Type="EXCLUSIVE"  Scope="APPLICATION">

        <CFSET Application.SRS.RequestTypes = RequestTypes>

        <CFModule Template="#Application.ModuleDir#/query-to-struct.cfm"

            DataQuery="#RequestTypes#"

            KeyFieldList="request_type_code"

            VariableName="Application.SRS.RequestTypesStruct">

    </CFLock>

query-to-struct.cfm:

    <CFParam Name="Attributes.DataQuery" Type="query">

    <CFParam Name="Attributes.KeyFieldList" Type="string">

    <CFParam Name="Attributes.VariableName" Type="string">

    <CFSET ResultStruct = StructNew()>

    <CFOutput Query="Attributes.DataQuery">

        <CFSET KeyString = "">

        <CFLoop List="#Attributes.KeyFieldList#" Index="field">

            <CFSET KeyString = ListAppend( KeyString, Evaluate( field ) )>

        </CFLoop>

        <CFSET ResultStruct[KeyString] = StructNew()>

        <CFLoop List="#Attributes.DataQuery.ColumnList#" Index="col">

            <CFSET ResultStruct[KeyString][col] = Evaluate( col )>

        </CFLoop>

    </CFOutput>

    <CFIF Attributes.VariableName contains ".">

        <CFSET "#Attributes.VariableName#" = ResultStruct>

    <CFELSE>

        <CFSET "Caller.#Attributes.VariableName#" = ResultStruct>

    </CFIF>

TOPICS
Getting started

Views

800

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 03, 2015 Sep 03, 2015

Copy link to clipboard

Copied

LATEST

Case-sensitivity perhaps? What happens if you change all occurrences of the relevant names into small letters? That is,

<CFQuery Name="requesttypes" DataSource="#Application.SRS.AppDataSource#" BlockFactor="100">

<CFSET Application.SRS.RequestTypes = requesttypes>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines