Solved

Testing for struct variables

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

777 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