0

My Custom tag expects a “query” in one of the attribute but my cfc function returns me the structure when I dump it. This is my function listScores()

<cffunction name="listScores" access="public" output="false" returntype="any"> <!--- not really scores, should probably rename this function - something to consider --->
    <cfargument name="link"      type="string"  required="false" />
    <cfargument name="linktype"  type="numeric" required="false" default="2" /> <!--- 2 = ace inspection -> ace action--->
    <cfargument name="reftype"   type="numeric" required="false" default="2" /> <!--- 2 = equipment --->
    <cfargument name="siteid"    type="numeric" required="false" />
    <cfargument name="archived"  type="numeric" required="false" default="0" /> <!--- 0 = not archived --->
    <cfargument name="acerefid"  type="numeric" required="false" hint="ace_links refid" />
    <cfargument name="apprefid"  type="numeric" required="false" hint="equip tracker refid" />
    <cfargument name="responseType" type="string" require="false" />

    <cfif structKeyExists(arguments,'responseType') && arguments.responseType is 'query'>
        <cfreturn OCRUD.listScores(argumentCollection=arguments) />
    </cfif>

    <cfreturn getArrayFromQuery(OCRUD.listScores(argumentCollection=arguments)) />

</cffunction>

When i dump the iEngine.listScores() i get the structure output.Dump

I want to pass this iEngine.listScores() data to the custom tag which expects a query.

<cfmodule template="#request.library.customtags.virtualpath#excel.cfm" file="#filename#" sheetname="ACE Report">
        <cfmodule template="#request.library.customtags.virtualpath#exceldata.cfm"
            query="#variables.qlistScoreData#" 
            action="AddWorksheet" 
            sheetname="ACE Report" 
            colorscheme="blue" 
            useheaders="true" 
            contentformat="#{bold=true}#"
            <!--- customheaders="#ListScore#" --->
        >               
            <cfoutput>Excel Extract - ACE Report - #DateFormat(Now(),"d-mmm-yyyy")#</cfoutput>

        </cfmodule> 
</cfmodule>
duncan
  • 31,401
  • 13
  • 78
  • 99
Vasu
  • 319
  • 5
  • 19
  • 3
    So in summary you have a structure you need to convert to a query? See [Ask Ben: Converting A Struct To A Query](http://www.bennadel.com/blog/264-ask-ben-converting-a-struct-to-a-query-and-more-java.htm) – duncan May 12 '14 at 13:04
  • Where is the code for OCRUD.listScores(): – Dan Bracuk May 12 '14 at 15:07
  • Regarding @duncan's comment, not necessarily. If the structure is built from a query, converting it back would be less efficient than not building the structure to start with. – Dan Bracuk May 12 '14 at 16:50

0 Answers0