Solved

Testing for struct variables

Posted on 2012-03-14
2
276 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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

12 Experts available now in Live!

Get 1:1 Help Now