Solved

Tricky Question on using StructFind or StructFindValue

Posted on 2004-09-15
5
775 Views
Last Modified: 2013-12-24
Hi,

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?

-WS
0
Comment
Question by:Westside2004
  • 2
  • 2
5 Comments
 
LVL 10

Expert Comment

by:Mause
ID: 12063366
Hi

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")

Mause
0
 
LVL 17

Expert Comment

by:Tacobell777
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?
0
 
LVL 1

Author Comment

by:Westside2004
ID: 12071747
Hi,

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

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

Thanks

0
 
LVL 10

Accepted Solution

by:
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")#
0
 
LVL 1

Author Comment

by:Westside2004
ID: 12081580
Yes, that worked.

Thanks a BIG BUNCH!!!

HIGHLY appreciated!
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

20 Experts available now in Live!

Get 1:1 Help Now