Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
WestSide #1
nested structure question....
Hi,
I posted a previous question somewhat similar to the one below, however, I am
trying to determine if I can even use structures in this manner..
I am getting erorrs like trying to dereference scalar values of type
java.string, etc. I also get some other error around my <cfset> tags because
of the period. I am using dot notation and it throws a basic error message as
well.
I am trying to create a nested structure, but have the name of the nested
structure be dynamic. So for every state in my loop, a new structure gets
created and its given a dynamic name. To further see what I am trying to do,
look at the StructInsert() that was used further down in the code...
Hope this makes sense.. There must be a solution to this. I am open to
another way as well...
<cfquery name="qryStates" datasource="#request.dsn#">
SELECT StateID, StateName
FROM States
</cfquery>
<cfquery name="qryNewCars" dbtype="query">
SELECT theCount
FROM TableName
WHERE theCar = 'N'
</cfquery>
I have 2-3 more of these queries similar to the one immediately above. They
just filter on if the car is new, old or used.
<cfset theStruct = structNew()>
<cfloop query="qryStates">
<cfset "#stateID#" = StructNew()>
<cfloop query="qryNewCars">
<cfset #stateID#.new = theCount>
</cfloop>
<cfloop query="qryUsedCars">
<cfset #stateID#.used = theCount>
</cfloop>
<cfloop query="qryOldCars">
<cfset #stateID#.old = theCount>
</cfloop>
<cfset StructInsert(theStruct, "#stateName#", #stateID#)>
</cfloop>
<cfdump var="#theStruct#">
<cfabort>
Any help appreciated..
thx
WestSide Guest
-
FMS app structure question
Hi I'm still feeling my way with media server and need a little help. I'm making a chat app with multiple rooms. I need to have a directory... -
Site Structure Question
I'm in the process of implemeting Contribute 3.1/CPS 1.1 under IIS6. Our organizational structure requires that user wear many hats, so in the site... -
Dynamic Structure Question?
Hi, I wanted to know if possible. Can I have a dynamic structure name? some generic query <cfquery name="qryTest"... -
Using CGI to return directory structure question
Is it possible to have a cgi hit the root directory and send the results to a table? I've seen where it can be done on the current directory, but... -
DB structure question
Access 2000. I'm trying to create a DB that stores records of books, but my understanding of DBases is very simple at best so, I have a table... -
Adam Cameron #2
Re: nested structure question....
> <cfset #stateID#.new = theCount>
That's a syntax error.
Try
<cfset "#stateID#.new" = theCount>
Or better:
<cfset variables["#stateID#.new"] = theCount>
Same problem in a couple of other places, too.
--
Adam
Adam Cameron Guest



Reply With Quote

