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

Comparing values within a cfloop

Explorer ,
Nov 09, 2006 Nov 09, 2006

Copy link to clipboard

Copied

Why Can I not loop over a query and and compare it's values to another variable?

Or better asked HOW CAN I?

I want to loop over the query and compare the field value to a form value and find a match.

Why I am I not simpy doing this in the query itself? Take a look at This post

I hope someone can give me some answers. My loop looks like this...

<cfloop query="#rsGetCustomers#" >
<cfscript>
phone = REReplaceNoCase(#cst_Phone#,"[,.-()]", "", "ALL" );
if (phone EQ REReplaceNoCase("#attributes.telephone#","[,.-()]", "", "ALL" ))
tempID = #rsGetCustomers.cst_ID#;
</cfscript>
</cfloop>

THanks all,
Chris
TOPICS
Advanced techniques

Views

306

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
Explorer ,
Nov 10, 2006 Nov 10, 2006

Copy link to clipboard

Copied

I've found that when looping over queries, sometimes some variables typically disappear. What I usually do just to avoid the madness is set a new local variable to what I'm going to compare. So in your case I'd try

cfset myTele = attributes.telephone

just before the cfloop command.

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
Explorer ,
Nov 10, 2006 Nov 10, 2006

Copy link to clipboard

Copied

LATEST
Thanks Michael. I did in the end get the solution on another forum.

Chris

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