Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6103705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:45:32+00:00 2026-05-23T13:45:32+00:00

Trying to display structExcelResult[strUrl] created by the function on my .cfm page. <cffunction name=getBuyerReport

  • 0

Trying to display structExcelResult[“strUrl”] created by the function on my .cfm page.

<cffunction name="getBuyerReport" output="false" access="public" returntype="struct">
<cfargument name="intRegionId" required="yes">
<cfargument name="intBuyerId" required="yes">
<cfargument name="intStage" required="yes">
<cfargument name="strSortField" required="yes">
<cfargument name="strSortDirection" required="yes">
<cfset var structExcelResult = StructNew()>
<cfset var qRead="" />

    <cfquery name="qRead" datasource="#variables.dsn#">
        SELECT CONVERT(varchar,t.RECEIVED_DATE,101) AS [Received Date] 
            , t.REQUISITION_NO AS [Requisition Number]
            , t.REQUISITION_TITLE AS [Requisition Title]
            , t.TECHNICAL_AUTHORITY_NAME AS [Technical Authority]
            , bm.BID_START_DATE AS [Solicitation Date]
            , bm.BID_END_DATE AS [Closing Date]
            , CAST(t.REQ_AMOUNT AS MONEY) AS [Requisition Value]
            , CAST(t.APPROVAL_AMOUNT AS MONEY) AS [Approval Value]
            , t.CURRENT_STAGE AS [Current Stage]
            , CONVERT(varchar,t.ESTIMATED_AWARD_DATE,101) AS [Estimated Award Date]
            , replace(replace(n.NOTE,CHAR(13),''),CHAR(10),'') as [Comments]
            , DATEDIFF(day, t.RECEIVED_DATE, getdate()) AS [Age of Requisition (days)]
            , cb.USER_NAME as [Buyer Name]
            , o.OFFICE_LOCATION_NAME as [Office Location]

        FROM VW__TOMBSTONES__CLIENT_CODES t
            LEFT OUTER JOIN TB__OFFICE_LOCATIONS o 
                ON o.ID = t.OFFICE__ID 
            LEFT OUTER JOIN TB__USERS cb 
                ON t.CURRENT_BUYER__ID = cb.ID
            LEFT OUTER JOIN TB__BID_MANAGEMENTS bm 
                ON bm.TB__TOMBSTONES__ID = t.ID
            LEFT OUTER JOIN TB__REQUISITIONS r 
                ON r.TOMBSTONES__ID = t.ID
            LEFT OUTER JOIN TB__NOTES n 
                ON n.REQUISITION__ID = r.ID
                AND t.CURRENT_STAGE = n.NOTE_TYPE

        WHERE t.CURRENT_STAGE <= 4
            AND n.NOTE_TYPE BETWEEN 1 AND 4
            AND t.REGION__ID = #arguments.intRegionId#
    </cfquery>


    <!--- Create new spreadsheet --->
    <cfset sObj = SpreadsheetNew()>

    <!--- Excel Functions --->
    <cfset countFormula="COUNTA(A8:A20000)">
    <cfset sumFormula="SUM(G2:G2000)">

    <!--- Create header row --->
    <cfset SpreadsheetMergeCells(sObj,1,1,1,2)>
    <cfset SpreadsheetSetCellValue(sObj, "BUYER REGISTER REPORT",1,1)>
    <cfset SpreadsheetFormatRow(sObj, {bold=TRUE, alignment="center"}, 1)>

    <cfset SpreadsheetSetCellValue(sObj, "Report Generated Date:",3,1)>
    <cfset SpreadsheetFormatCell(sObj, {bold=TRUE, alignment="right"}, 3,1)>
    <cfset SpreadsheetSetCellValue(sObj, "#ToString(DateFormat(now(), "mmmm d yyyy"))#",3,2 )>
    <cfset SpreadsheetFormatCell(sObj, {bold=TRUE, alignment="left"}, 3,2)>

    <cfset SpreadsheetSetCellValue(sObj, "Number of Requisitions:",4,1)>
    <cfset SpreadsheetFormatCell(sObj, {bold=TRUE, alignment="right"}, 4,1)>
    <cfset SpreadsheetSetCellFormula(sObj,countFormula, 4, 2)>
    <cfset SpreadsheetFormatCell(sObj, {bold=TRUE, alignment="left"}, 4,2)>

    <cfset SpreadsheetSetCellValue(sObj, "Value of Requisitions:",5,1 )>
    <cfset SpreadsheetFormatCell(sObj, {bold=TRUE, alignment="right"}, 5,1)>
    <cfset SpreadsheetSetCellFormula(sObj,sumFormula, 5, 2)>
    <cfset SpreadsheetFormatCell(sObj, {bold=TRUE, alignment="left"}, 5,2)>
    <cfset SpreadsheetFormatCell(sObj, {dataformat="$##,##0.00"}, 5,2)>

    <cfset SpreadsheetAddRow(sObj, "" )>
    <cfset SpreadsheetAddRow(sObj, "RECEIVED DATE,REQUISITION NUMBER,REQUISITION TITLE,TECHNICAL AUTHORITY,SOLICITATION DATE,CLOSING DATE,REQUISITION VALUE,APPROVAL VALUE,CURRENT STAGE,ESTIMATED AWARD DATE,COMMENTS,AGE OF REQUISITION (DAYS),BUYER NAME,OFFICE LOCATION")>
    <cfset SpreadsheetFormatRow(sObj, {bold=TRUE}, 7)>

    <!--- Add orders from query --->
    <cfset SpreadsheetAddRows(sObj, qRead)>
    <cfset SpreadsheetFormatColumns(sObj, {dataformat="$##,##0.00"}, "7-8")>
    <cfset SpreadsheetFormatColumns(sObj, {alignment="center"}, "9-10")>
    <cfset SpreadsheetFormatColumns(sObj, {alignment="center"}, "12-15")>

    <!--- Excel document naming and storing location --->
    <cfset strDir=GetDirectoryFromPath(GetCurrentTemplatePath())&"/../assets/generatedXLS/">
    <cfset strFilePrepend = "-BuyerReport-" />
    <cfset strFileNameStamp = "Galileo" & "#strFilePrepend#" & "#ToString(DateFormat(now(), "yy-mm-dd"))#" & "-#ToString(TimeFormat(now(), "HHmmss"))#" & ".xls"/>

    <cfspreadsheet action="write" 
        filename="#strDir##strFileNameStamp#" 
        name="sObj" 
        overwrite="true" 
        sheetname="Active (Stages 1-4)">

    <cfset structExcelResult["strURL"] = "/web_apps/app/assets/generatedXLS/" & #strFileNameStamp# />
    <cfset structExcelResult["strNoRecordsFoundMsg"] = "" />

<cfreturn structExcelResult>

How do I fetch that data (structExcelResult[“strURL”]) and display it on my .cfm page?

I’m new at this and going through Ben Forta books… Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:45:33+00:00Added an answer on May 23, 2026 at 1:45 pm

    Since you have a cfreturn in your code, I’ll assume that was meant to have been wrapped in cffunction.

    You can call a cffunction a couple of different ways. It could be on the same .cfm page that you’re on:

    <cffunction name="sayHello" output="false">
         <cfargument name="username" type="string" required="false" default="Anonymous" />
         <cfreturn "Hello, " & username />
    </cffunction>
    
    <cfoutput>#sayHello( 'Charlie' )#</cfoutput>
    

    However, it’s more likely that your function is part of a ColdFusion Component (CFC). To call a function that’s part of a CFC, you first have to instantiate the CFC:

    <cfset myCFC = createObject( 'component', 'path.to.my.cfc' ) />
    

    Now you can call any method that resides in the CFC via:

    <cfoutput>#myCFC.myFunction( 'foo' )#</cfoutput>
    

    Going back to my first (very simple) example, let’s say the sayHello() function resided in the Greeting.cfc file that was at /com/Greeting.cfc.

    <cfset greeting = createObject( 'component', 'com.greeting' ) />
    <cfoutput>#greeting.sayHello( 'Charlie' )#</cfoutput>
    

    You can use anything you’d like for the name. It doesn’t have to be myCFC or greeting. It’s just a variable that represents a hook into your component.

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to display an address right aligned in the footer of my page
I'm trying to display all the values from a specific column created by my
I am trying to display an .svg file in a HTML page using jQuery
When trying to display a byte stream from HLDS (Half-Life Dedicated Server) in a
I've been trying to display text using a Quartz context, but no matter what
I'm trying to display a series of titles varying from 60 characters to 160
I am trying to display a list of all files found in the selected
I'm trying to display a loading icon while my iPhone app downloads a network
I'm trying to display an array of files in order of date (last modified).
I'm trying to display a caret ( ^ ) in math mode in LaTeX

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.