isDefined and syntactically correct variable name

Posted on 2007-07-24
Last Modified: 2008-02-01
i am trying to validate the existance of a dynamicaly named variable but i am getting an error when i check it

Parameter 1 of function IsDefined which is now "arrTracking[idx+1]['en']" must be a syntactically valid variable name

suggestions on how i can fix this?

Question by:Jester_48
    LVL 24

    Author Comment

    iv solved teh processing issue by using a try-catch, but i would stil,like to know if i can use isDefined in some way

    LVL 39

    Accepted Solution



    It looks like you're testing for the existance of a structure element, not a variable.

    <cfif structKeyExists(arrTracking[idx+1], langIdx)>

    will test to see if langIdx is a key at that array location

    <cfif (idx+1) le arrayLen(arrTracking)  and  structKeyExists(arrTracking[idx+1], langIdx)>

    This will test the array location and then the struct key at that location

    LVL 24

    Author Comment

    thanks works perfectly!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
    Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now