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

CFIF / CFELSE Coding Question

New Here ,
Jun 07, 2011 Jun 07, 2011

Copy link to clipboard

Copied

I'm not very proficient in ColdFusion but can usually get by. However, we added a third member category option and I can't seem to get the coding to work properly. Here's what we are trying to do:

There are 3 categories to choose from: Growing Company, Investor and Professional. Under Growing Company there are 3 different levels to choose from (there used to only be 2). For Investors and Professionals it is just one level.

Here is the current, broken code. We are finding that people who try to join at the $255 level or at the $695 team are seeing BOTH categories -- they are getting confused as to what they are signing up for.

<CFIF #memberCategory# IS "companyMember">
           <CFIF #memberType# IS "growingTeam">


               Membership Category: <b>Entrepreneur & Management Team, Team Membership - $695</b>
</CFIF>

           <CFIF #memberType# IS "growingSingle">
                       Membership Category: <b>Entrepreneur & Management Team, Single Membership - $495</b>
        <CFELSE>
               Membership Category: <b>Entrepreneur & Management Team, 2011 Entrepreneur - $255</b>


           </CFIF>

       <CFELSEIF #memberCategory# IS "investorMember">
               Membership Category: <b>Investor - $495</b>

       <CFELSE>
               Membership Category: <b>Professional - $895</b>

       </CFIF>

Before adding this new $255 level, everything worked well. Anyone have a solution?

Your help is greatly appreciated. Thank you!

Tonya

Views

3.5K

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

Valorous Hero , Jun 07, 2011 Jun 07, 2011

You may have lucked out.  I got curious and played with this.

Is this what you are trying to do?

<CFIF memberCategory IS "companyMember">
    <CFIF memberType IS "growingTeam">

        Membership Category: <b>Entrepreneur & Management Team, Team Membership - $695</b>

    <CFELSEIF memberType IS "growingSingle">   

        Membership Category: <b>Entrepreneur & Management Team, Single Membership - $495</b>

    <CFELSE>

        Membership Category: <b>Entrepreneur & Management Team, 2011 Entrepreneur - $

...

Votes

Translate

Translate
Valorous Hero ,
Jun 07, 2011 Jun 07, 2011

Copy link to clipboard

Copied

The way your logic is structured you are going to get ONE of Category A AND one of Category B.

I.E. your member category logic and member type logic is NOT mutually exclusive.  OUTPUT from both is going to occur.

This is an exercise in basic programming boolean logic and is not specific to CFML.  It is hard to say how to help you, since I am not really sure what you are tyring to do.  But it looks like you need some AND and|or OR clauses in your logic.

The crudest example might just be something like.

if membercategory IS 'companyMember" AND membertype is 'growingTeam'

     ... 695

else if membercategory IS 'companyMember' AND membertype is 'growingSingle'

     ... 495


.....

But I would need to know a lot more about your business requirements then I can glean from this code example to provide a proper boolean logic tree.

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
Valorous Hero ,
Jun 07, 2011 Jun 07, 2011

Copy link to clipboard

Copied

You may have lucked out.  I got curious and played with this.

Is this what you are trying to do?

<CFIF memberCategory IS "companyMember">
    <CFIF memberType IS "growingTeam">

        Membership Category: <b>Entrepreneur & Management Team, Team Membership - $695</b>

    <CFELSEIF memberType IS "growingSingle">   

        Membership Category: <b>Entrepreneur & Management Team, Single Membership - $495</b>

    <CFELSE>

        Membership Category: <b>Entrepreneur & Management Team, 2011 Entrepreneur - $255</b>

    </CFIF>

<CFELSEIF memberCategory IS "investorMember">

    Membership Category: <b>Investor - $495</b>

<CFELSE>

    Membership Category: <b>Professional - $895</b>

</CFIF>

You may see how proper spacing can help sort out the logic.

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 ,
Jun 08, 2011 Jun 08, 2011

Copy link to clipboard

Copied

LATEST

IIssac, this worked perfectly. Thank you so much, you've rescued me!

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