?
Solved

Testing for struct variables

Posted on 2012-03-14
2
Medium Priority
?
282 Views
Last Modified: 2012-03-14
I'm working with the Twitter API and am testing for the session variable (which exists) of SESSION.userdetails.accesspoint.  However, the cfinvoke is not being executed upon this condition.  Since I had a similar test not work until I simplified the structKeyExists, is this the correct way to test for this session variable?

<cfif structKeyExists(SESSION, 'userdetails.accesspoint') AND SESSION.userdetails.accesspoint EQ "Twitter">
0
Comment
Question by:perdiemconsulting
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

by:
micropc1 earned 2000 total points
ID: 37721847
Yes - structKeyExists is the best way to check for the existence of a structure key.

This is probably what you want...

<cfif structKeyExists(SESSION.userDetails, "accessPoint") AND SESSION.userDetails.accessPoint EQ "Twitter">
0
 

Author Closing Comment

by:perdiemconsulting
ID: 37721891
Thanks.  That is exactly what I needed.  I had not worked with complex structures and was not sure if I was writing that correctly.  When I set it that way, it worked as expected.  Thanks.
0

Featured Post

TCP/IP Network Protocol Cheat Sheet

TCP/IP is a set of network protocols which is best known for connecting the machines that make up the Internet. The truth is that TCP/IP is one of the oldest network protocols and its survival is mainly based on its simplicity and universality.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

801 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