Solved

Testing for struct variables

Posted on 2012-03-14
2
280 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 500 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

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…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 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