if()


Oh, and you forgot the break; in the first 2 case statements

-----Original Message-----
From: Ryan Mitchell [mailto:[EMAIL PROTECTED]
Sent: Monday, November 17, 2003 7:07 AM
To: CF-Talk
Subject: Re: Very vague error message

Ok, tracked it down to the switch statement:

            switch(type)
            {
                case request.AUTH_ACL:
                    result = u_access[j][key];

                case request.AUTH_MOD:
                    result = result OR u_access[j]['auth_mod'];

                case request.AUTH_ADMIN:
                    result = result OR is_admin;
                    break;
            }

On reading the cf reference I see that in a switch statement:
³Each constant value must be a constant (that is, not a variable, a
function, or other _expression_).²

As you can see each of my caseıs is a variable which is the problem...
Is
there any way of using the variable but not getting the error?

On 17/11/03 3:17 am, "Michael S. Hodgdon" <[EMAIL PROTECTED]>
wrote:

> I have never come across this in a ColdFusion.  One way you can try to
> pinpoint the error is to place <cfabort> statement at say, line 50.
Run your
> code and if you don't get an error, place the <cfabort> on line 100
and run
> the code.  Keep doing this until you get closer to the error.
>
> Do you have any idea where it could be?  It sounds as though
ColdFusion is
> saying do not place a dynamic variable in this evaluating statement.
I
> can't think of a place where this would be so.  Are you using
<cfscript> in
> this page anywhere?  If so, if you are using a case statement that
reads
> case constant, this may be the culprit.
>
> Hope that helps.
>
>   -----Original Message-----
>   From: Ryan Mitchell [mailto:[EMAIL PROTECTED]
>   Sent: Sunday, November 16, 2003 10:41 AM
>   To: CF-Talk
>   Subject: Very vague error message
>
>   Hello
>
>   I have a rather large page of code which ive been working on, and I
get
> the
>   following error:
>
>   This _expression_ must have a constant value.
>
>   It doesnıt give me a line number, or a code snippet, just that text.
>
>   As I said I have a lot of code (1000+ lines) and I cant quite tie
down the
>   problem... Has anyone come across this before?
>
>   Thanks,
>   Ryan
>
>
>
  _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to