• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

compare values

Guest
Oct 21, 2014 Oct 21, 2014

Copy link to clipboard

Copied

Hi,

I have the query with out put below for one field as an example

Status

------

yes

yes

yes

no

i want to be able to do the compare for ALL status in one field but don't know how to do it, Can anyone plz help? Thanks

<cfif all status = "yes" ---> display  Yes

<cfelseif all status = No -- display No

<cfelse> Other

</cfif>

TOPICS
Getting started

Views

415

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
LEGEND ,
Oct 27, 2014 Oct 27, 2014

Copy link to clipboard

Copied

Let's say the query name is "qry" and the column name is "booln".

A query object is really an array.

<cfset display = "">

<cfif ArrayFindNoCase(qry.booln,"no") AND NOT ArrayFindNoCase(qry.booln,"yes")>

  <cfset display = "no">

<cfelseif ArrayFindNoCase(qry.booln,"yes") AND NOT ArrayFindNoCase(qry.booln,"no")>

  <cfset display = "yes">

<cfelse>

  <cfset display = "both">

<cfif>

HTH,

^_^

Votes

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
Community Expert ,
Nov 01, 2014 Nov 01, 2014

Copy link to clipboard

Copied

<cfset numberOfYeses = 0>

<cfoutput query="myQuery">

    <cfif status EQ "yes">

        <cfset numberOfYeses = numberOfYeses + 1>

    </cfif>

</cfoutput>

<cfif numberOfYeses EQ myQuery.recordCount>

    <!--- Then there were all Yeses --->

<cfelseif numberOfYeses EQ 0>

    <!--- Then there were all Nos --->

<cfelse>

    <!--- Then there were Yeses and Nos --->

</cfif>

Votes

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
New Here ,
Nov 06, 2014 Nov 06, 2014

Copy link to clipboard

Copied

LATEST

Hi,

If your query name is "myquery" and the status column name is "status" then you can check like below:

           <cfoutput query="myquery">          

            <br />

                <cfif #myquery.status# eq "yes">

                     #myquery.status#

                <cfelse>

                      #myquery.status#

                </cfif>               

           </cfoutput>

If you want same status continuously then you can use order by in your query.

Votes

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
Resources
Documentation