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

Concatenating if statements

New Here ,
Dec 13, 2006 Dec 13, 2006

Copy link to clipboard

Copied

I have 44 if statements the results i would like to have is this my loop goes throught the 44 statements to see if any of them are true.
what i want is if there is more than on of them that are true then to out put them for some reason it only outputs 1
I would also like to concatenate them all if more than one

here is my code:
TOPICS
Advanced techniques

Views

575

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

correct answers 1 Correct answer

Community Beginner , Dec 15, 2006 Dec 15, 2006
I think I misunderstood what you're trying to do. Are you just pulling one row from a table and trying to display the value if one exists for the field?

I'm also kind of thrown off by your <cfloop> that always only loops one time. What's the point of it?

Votes

Translate

Translate
LEGEND ,
Dec 13, 2006 Dec 13, 2006

Copy link to clipboard

Copied

The reason is that you are uisng cfelseif. Once the first condition is satisfied, no more elseif's run.

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 ,
Dec 13, 2006 Dec 13, 2006

Copy link to clipboard

Copied

so if i just used the cfif statement one after the other it should work?

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
LEGEND ,
Dec 13, 2006 Dec 13, 2006

Copy link to clipboard

Copied

quote:

Originally posted by: mactech999
so if i just used the cfif statement one after the other it should work?

Probably.

What happened when you tried it?

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 ,
Dec 14, 2006 Dec 14, 2006

Copy link to clipboard

Copied

it only shows the first one it finds

I think it may have something to do with my loop

I only loop on the CfgDisplay

here is the loop

<cfloop index="loopcount" from="1" to="1">
<font size="+1"><strong>#CfgDisplay#</font></strong><p>
</cfloop>

should I be looping through all of the code or is this ok?

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 Beginner ,
Dec 14, 2006 Dec 14, 2006

Copy link to clipboard

Copied

You are resetting CfgDisplay within each <cfif> block, so its value will always be the value of the last <cfif> block that executes.

Maybe this would work for you: set CfgDisplay to an empty string before all cfif blocks, then use ListAppend() within each block so at the end you'll have a list of values.

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 ,
Dec 15, 2006 Dec 15, 2006

Copy link to clipboard

Copied

nope didn't work

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 ,
Dec 15, 2006 Dec 15, 2006

Copy link to clipboard

Copied

this is the result it gives me

58340008 Front 2 Suspension Stabilizer Bar Link Kit
Use With: DriveType: RWD SubModel: DLX

58340005 Front Left 1 Suspension Stabilizer Bar Link Kit
Use With: DriveType: RWD SubModel: DLX DriveType: 4WD

58340005 Front Left 1 Suspension Stabilizer Bar Link Kit
Use With: DriveType: RWD SubModel: DLX DriveType: 4WD DriveType: RWD SubModel: Pre Runner

58340006 Front Right 1 Suspension Stabilizer Bar Link Kit
Use With: DriveType: RWD SubModel: DLX DriveType: 4WD DriveType: RWD SubModel: Pre Runner DriveType: 4WD

58340006 Front Right 1 Suspension Stabilizer Bar Link Kit
Use With: DriveType: RWD SubModel: DLX DriveType: 4WD DriveType: RWD SubModel: Pre Runner DriveType: 4WD DriveType: RWD SubModel: Pre Runner

there should only be one drive type per number and one sub model
but they seem to keep repeating themselves

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 Beginner ,
Dec 15, 2006 Dec 15, 2006

Copy link to clipboard

Copied

LATEST
I think I misunderstood what you're trying to do. Are you just pulling one row from a table and trying to display the value if one exists for the field?

I'm also kind of thrown off by your <cfloop> that always only loops one time. What's the point of it?

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