6 Replies Latest reply: Jul 28, 2006 3:31 PM by Ronsweb RSS

    <cfoutput query> problems

    Ronsweb Community Member
      I am having a problem with formating results of a query. The Database is access using CFMX 7 JRUN multiserver version. The problem is thatf I use <cfoutput query="qmysignsret"> the result will not carraige return. If I just use <cfoutput>
      the text will carriage return. Here is the code:

      <cfset text3 = Replace(Replace(qmysignsret.text3, chr(32),' ','all'), Chr(10), '<br>', 'All')><br>


      Text output with <cfoutput query="qmysignsret">
      The grass is really greener.


      Text output with <cfoutput>
      The grass is really
      greener.


      Any help is appreciated!
      Thanks,

      Ron
        • 1. Re: &lt;cfoutput query&gt; problems
          jdeline Community Member
          Please provide the actual code that includes the query and the beginning and end of the CFOUTPUT and/or CFLOOP. And place your code in the "Attach Code" area. It displays it using nonproportional font, which will show where your spaces are in the Replace function.
          • 2. Re: &lt;cfoutput query&gt; problems
            Dan Bracuk Community Member
            Generally, replacing chr(10) with <br /> gets the job done. I don't see that in your code.
            • 3. Re: &lt;cfoutput query&gt; problems
              Ronsweb Community Member
              I actually copied the output on the html page. The <br> and   did not show up.
              Here is the actual replace function.
              <cfset text3 = Replace(Replace(qmysignsret.text3, chr(32),' ','all'), Chr(10), '<br>', 'All')><br>

              Thanks
              Ron
              • 4. Re: &lt;cfoutput query&gt; problems
                Ronsweb Community Member
                I just tested it on SQL 2000 and the same problem exist. I thought maybe it is a access problem. I wonder if this is a bug with CF?


                • 5. &lt;cfoutput query&gt; problems
                  Ronsweb Community Member


                  I have tested on both mx 7 and 6.1 servers. This is not just with our environment. It is with a outside host that I also use.


                  Here is the actual code:

                  <cfinvoke component="testaccess" method="qsigninfo" sign_ID="659" returnvariable="qmysignsret">
                  <cfset text3 = Replace(Replace(qmysignsret.text3, chr(32),' ','all'), Chr(10), '<br>', 'All')><br>
                  <br>

                  <br>


                  <strong>Text output with &ltcfoutput query="qmysignsret"&gt</strong><br>
                  <cfoutput query="qmysignsret">#text3#</cfoutput>
                  <br>
                  <br>
                  <br>
                  Text output with &ltcfoutput&gt<br>
                  <cfoutput>#text3#</cfoutput>




                  ----------------------------------------------------------------
                  Here is the cfc

                  <cfcomponent>

                  <cffunction access="remote" name="qsigninfo" output="false" returntype="query">
                  <cfargument name="sign_ID" type="numeric" required="no" default="">

                  <cfquery name="qsigninfo" datasource="acit">
                  SELECT *
                  FROM ez4X4_1template
                  WHERE sign_ID = <cfqueryparam value="#arguments.sign_ID#" cfsqltype="CF_SQL_NUMERIC">
                  </cfquery>
                  <cfreturn qsigninfo>
                  </cffunction>

                  </cfcomponent>
                  • 6. Re: &lt;cfoutput query&gt; problems
                    Ronsweb Community Member
                    I finally figured out how to get the text to return with <cfoutput query=qmyqueryret>

                    Here is the code:

                    <cfoutput query="qmyqueryret">
                    <cfset formatedtext3 = Replace(qmyqueryret.text3,chr(32)," ","all")>
                    <cfset formatedtext3 = ReReplace(formatedtext3, "\n", "<br />", "ALL")>
                    #formatedtext3#
                    </cfoutput>