Tricky Question on using StructFind or StructFindValue

Posted on 2004-09-15
Last Modified: 2013-12-24

I am trying to write this query that has some conditional logic.  I urgently need a solution if anyone is around.

I get the error (below) when trying to do this:

You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members.

My code snippet from the actual query is as follows:

<cfif StructFindValue(#currentStructure.List#, "ABC")>,Some_Code, Some_Amount</cfif>

and then in the   VALUES part of the query I have:

( <cfif StructFindValue(#currentStructure.List#, "ABC")>,'XL',40</cfif>

I am trying to find the value "ABC" in the structure and if so, then add the columns Some_Code and Some_Amount with values of  'XL' and '40'

Can someone PLEASE tell me where I am going wrong?  Should I use StructFind? or StructFindValue?

Question by:Westside2004
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
  • 2
LVL 10

Expert Comment

ID: 12063366

How does your structure look like? (use cfdump)
What is in #currentStructure.List#

if #currentStructure.List# contains 'abc' (string and not a structure) try this:
StructFindValue(#currentStructure#, "ABC")

LVL 17

Expert Comment

ID: 12070244
Are you trying to find a key in the structure or a value in the structure?
Use structFind to find a key and structFindValue to find a value

are you sure currentStructure.List is a structure and not a list , i.e. string?

Author Comment

ID: 12071747

I think its a list.... i did a dump and its comma separated....

Is it possible it could be a list within a structure?


LVL 10

Accepted Solution

Mause earned 250 total points
ID: 12072137
Yes you could have a list in a structure
to see if  "ABC" is in the list

#ListFind(currentStructure.List, "ABC")#

Author Comment

ID: 12081580
Yes, that worked.

Thanks a BIG BUNCH!!!

HIGHLY appreciated!

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

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