Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

isDefined and syntactically correct variable name

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?

James Rodgers
James Rodgers
  • 2
1 Solution
James RodgersWeb Applications DeveloperAuthor Commented:
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



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

James RodgersWeb Applications DeveloperAuthor Commented:
thanks works perfectly!

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now