Dynamic structure key names

2002-04-11 Thread Kay Smoljak

Hi all,

I'm stuck on the syntax for this. I have a structure. What I'm trying to
do is loop over a query, and create a new structure (dynamically named
with the primary key of the record as a structure key) with three values
from that record. I think I must be doing something wrong syntax-wise,
and I can't find any examples in the docs or the archives.

I have tried these (within a query loop): 
cfset payment.[due.pkWebUser] = StructNew()
cfset payment.evaluate(due.pkWebUser) = StructNew()
cfset payment.#due.pkWebUser# = StructNew()

But nothing is working so far. Any ideas on how to do this or how it can
be done easier?

Kay.

__ 
Kay Smoljak - ColdFusion Developer - PerthWeb Pty Ltd 
  
Level 9/105 St George's Terrace - Perth - Western Australia 
Ph: (08) 9226 1366 Fax: (08) 9226 1375 www.perthweb.com.au

http://developer.perthweb.com.au - Tools for Developers
cfx_pwcamtech | cfx_pwimageproc | cfx_pwcardcyrpt


 
 

__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Dynamic structure key names

2002-04-11 Thread Pascal Peters

cfset payment = StructNew()
cfloop query=due
cfset payment[due.pkWebUser] = StructNew()
cfset payment[due.pkWebUser].key1 = due.col2
cfset payment[due.pkWebUser].key2 = due.col3
cfset payment[due.pkWebUser].key3 = due.col4
/cfloop

Pascal
-Original Message-
From: Kay Smoljak [mailto:[EMAIL PROTECTED]]
Sent: donderdag 11 april 2002 11:11
To: CF-Talk
Subject: Dynamic structure key names


Hi all,

I'm stuck on the syntax for this. I have a structure. What I'm trying to
do is loop over a query, and create a new structure (dynamically named
with the primary key of the record as a structure key) with three values
from that record. I think I must be doing something wrong syntax-wise,
and I can't find any examples in the docs or the archives.

I have tried these (within a query loop): 
cfset payment.[due.pkWebUser] = StructNew()
cfset payment.evaluate(due.pkWebUser) = StructNew()
cfset payment.#due.pkWebUser# = StructNew()

But nothing is working so far. Any ideas on how to do this or how it can
be done easier?

Kay.

__ 
Kay Smoljak - ColdFusion Developer - PerthWeb Pty Ltd 
  
Level 9/105 St George's Terrace - Perth - Western Australia 
Ph: (08) 9226 1366 Fax: (08) 9226 1375 www.perthweb.com.au

http://developer.perthweb.com.au - Tools for Developers
cfx_pwcamtech | cfx_pwimageproc | cfx_pwcardcyrpt


 
 


__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Dynamic structure key names

2002-04-11 Thread Dave Carabetta

 Hi all,

 I'm stuck on the syntax for this. I have a structure. What I'm trying to
 do is loop over a query, and create a new structure (dynamically named
 with the primary key of the record as a structure key) with three values
 from that record. I think I must be doing something wrong syntax-wise,
 and I can't find any examples in the docs or the archives.

 I have tried these (within a query loop):
 cfset payment.[due.pkWebUser] = StructNew()
 cfset payment.evaluate(due.pkWebUser) = StructNew()
 cfset payment.#due.pkWebUser# = StructNew()

 But nothing is working so far. Any ideas on how to do this or how it can
 be done easier?


Try this. Just had a similar problem...

cfset payment[#due.pkWebUser#] = StructNew()

Then when you want to set a key, you can just do:

cfset variables.temp = StructInsert(payment[#due.pkWebUser#], keyName,
value)

Hope this helps,
Dave.
__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Dynamic structure key names

2002-04-11 Thread Kay Smoljak

Great, thanks. I was nearly there... been working on JavaScript for so
long today I think it's affected my brain!

Kay.

Pascal Peters [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 cfset payment = StructNew()
 cfloop query=due
   cfset payment[due.pkWebUser] = StructNew()
   cfset payment[due.pkWebUser].key1 = due.col2
   cfset payment[due.pkWebUser].key2 = due.col3
   cfset payment[due.pkWebUser].key3 = due.col4
 /cfloop
 
 Pascal
 -Original Message-
 From: Kay Smoljak [mailto:[EMAIL PROTECTED]]
 Sent: donderdag 11 april 2002 11:11
 To: CF-Talk
 Subject: Dynamic structure key names
 
 
 Hi all,
 
 I'm stuck on the syntax for this. I have a structure. What I'm trying 
 to do is loop over a query, and create a new structure (dynamically 
 named with the primary key of the record as a structure key) with 
 three values from that record. I think I must be doing something wrong

 syntax-wise, and I can't find any examples in the docs or the 
 archives.
 
 I have tried these (within a query loop):
 cfset payment.[due.pkWebUser] = StructNew()
 cfset payment.evaluate(due.pkWebUser) = StructNew()
 cfset payment.#due.pkWebUser# = StructNew()
 
 But nothing is working so far. Any ideas on how to do this or how it 
 can be done easier?
 
 Kay.
 
 __
 Kay Smoljak - ColdFusion Developer - PerthWeb Pty Ltd 
   
 Level 9/105 St George's Terrace - Perth - Western Australia
 Ph: (08) 9226 1366 Fax: (08) 9226 1375 www.perthweb.com.au
 
 http://developer.perthweb.com.au - Tools for Developers cfx_pwcamtech 
 | cfx_pwimageproc | cfx_pwcardcyrpt
   
 
  
  
 
 
 
__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Dynamic structure key names

2002-04-11 Thread David Schmidt

 I have tried these (within a query loop): 
 cfset payment.[due.pkWebUser] = StructNew()
 cfset payment.evaluate(due.pkWebUser) = StructNew()
 cfset payment.#due.pkWebUser# = StructNew()
 

cfset payment.due[#pkWebUser#] = structNew()


__
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Dynamic structure key names

2002-04-11 Thread Raymond Camden

 
 cfset payment.due[#pkWebUser#] = structNew()
 
 

No need for quotes or for # signs.

cfset payment.due[pkWebUser] = structNew()

===
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

Email: [EMAIL PROTECTED]
Yahoo IM : morpheus

My ally is the Force, and a powerful ally it is. - Yoda 

__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Dynamic structure key names

2002-04-11 Thread Justin Scott

Actually, you do need them when setting a dynamic variable in this way.  You
could use the setVariable() function to avoid using the quotes and pounds,
however.

-Justin Scott, Lead Developer
 Sceiron Internet Services, Inc.
 http://www.sceiron.com


- Original Message -
From: Raymond Camden [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Thursday, April 11, 2002 9:59 AM
Subject: RE: Dynamic structure key names


 
  cfset payment.due[#pkWebUser#] = structNew()
 
 

 No need for quotes or for # signs.

 cfset payment.due[pkWebUser] = structNew()

 ===
 Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

 Email: [EMAIL PROTECTED]
 Yahoo IM : morpheus

 My ally is the Force, and a powerful ally it is. - Yoda

 
__
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Dynamic structure key names

2002-04-11 Thread Raymond Camden

Eh? The user wants to set a dynamic key to a NAMED struct, payment.due.
This isn't a dynamic variable. It's a dynamic key.

Hence, no need for  or setVariable.

===
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

Email: [EMAIL PROTECTED]
Yahoo IM : morpheus

My ally is the Force, and a powerful ally it is. - Yoda 

 -Original Message-
 From: Justin Scott [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, April 11, 2002 10:26 AM
 To: CF-Talk
 Subject: Re: Dynamic structure key names
 
 
 Actually, you do need them when setting a dynamic variable in 
 this way.  You
 could use the setVariable() function to avoid using the 
 quotes and pounds,
 however.
 
 -Justin Scott, Lead Developer
  Sceiron Internet Services, Inc.
  http://www.sceiron.com
 
 
 - Original Message -
 From: Raymond Camden [EMAIL PROTECTED]
 To: CF-Talk [EMAIL PROTECTED]
 Sent: Thursday, April 11, 2002 9:59 AM
 Subject: RE: Dynamic structure key names
 
 
  
   cfset payment.due[#pkWebUser#] = structNew()
  
  
 
  No need for quotes or for # signs.
 
  cfset payment.due[pkWebUser] = structNew()
 
  
 ==
 =
  Raymond Camden, Principal Spectra Compliance Engineer for Macromedia
 
  Email: [EMAIL PROTECTED]
  Yahoo IM : morpheus
 
  My ally is the Force, and a powerful ally it is. - Yoda
 
  
 
__
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Dynamic structure key names

2002-04-11 Thread Pascal Peters

You're a brave man, going against Ray on his favorite toppic. If you have a closer 
look, you will see that Ray is (of course) right and you are wrong. No quotes or # 
signs needed. In general, try to avoid them when you don't need them.

Pascal Peters
Certified ColdFusion (5.0) Advanced Developer
Certified Web Developer
Macromedia Certified Instructor
LR Technologies, Belgium
Tel +32 2 639 68 70
Fax +32 2 639 68 99
Email   [EMAIL PROTECTED]
Web www.lrt.be

-Original Message-
From: Justin Scott [mailto:[EMAIL PROTECTED]]
Sent: donderdag 11 april 2002 16:26
To: CF-Talk
Subject: Re: Dynamic structure key names


Actually, you do need them when setting a dynamic variable in this way.  You
could use the setVariable() function to avoid using the quotes and pounds,
however.

-Justin Scott, Lead Developer
 Sceiron Internet Services, Inc.
 http://www.sceiron.com


- Original Message -
From: Raymond Camden [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Thursday, April 11, 2002 9:59 AM
Subject: RE: Dynamic structure key names


 
  cfset payment.due[#pkWebUser#] = structNew()
 
 

 No need for quotes or for # signs.

 cfset payment.due[pkWebUser] = structNew()

 ===
 Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

 Email: [EMAIL PROTECTED]
 Yahoo IM : morpheus

 My ally is the Force, and a powerful ally it is. - Yoda

 

__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Dynamic structure key names

2002-04-11 Thread Justin Scott

Ack..  you're right.  Sorry for any confusion..  too early in the morning
for this stuff, hehe.

-Justin Scott, Lead Developer
 Sceiron Internet Services, Inc.
 http://www.sceiron.com


- Original Message -
From: Raymond Camden [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Thursday, April 11, 2002 10:35 AM
Subject: RE: Dynamic structure key names


 Eh? The user wants to set a dynamic key to a NAMED struct, payment.due.
 This isn't a dynamic variable. It's a dynamic key.

 Hence, no need for  or setVariable.

 ===
 Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

 Email: [EMAIL PROTECTED]
 Yahoo IM : morpheus

 My ally is the Force, and a powerful ally it is. - Yoda

  -Original Message-
  From: Justin Scott [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, April 11, 2002 10:26 AM
  To: CF-Talk
  Subject: Re: Dynamic structure key names
 
 
  Actually, you do need them when setting a dynamic variable in
  this way.  You
  could use the setVariable() function to avoid using the
  quotes and pounds,
  however.
 
  -Justin Scott, Lead Developer
   Sceiron Internet Services, Inc.
   http://www.sceiron.com
 
 
  - Original Message -
  From: Raymond Camden [EMAIL PROTECTED]
  To: CF-Talk [EMAIL PROTECTED]
  Sent: Thursday, April 11, 2002 9:59 AM
  Subject: RE: Dynamic structure key names
 
 
   
cfset payment.due[#pkWebUser#] = structNew()
   
   
  
   No need for quotes or for # signs.
  
   cfset payment.due[pkWebUser] = structNew()
  
  
  ==
  =
   Raymond Camden, Principal Spectra Compliance Engineer for Macromedia
  
   Email: [EMAIL PROTECTED]
   Yahoo IM : morpheus
  
   My ally is the Force, and a powerful ally it is. - Yoda
  
  
 
 
__
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Dynamic structure key names

2002-04-11 Thread Justin Scott

Yeah..  I looked at it and thought dynamic variable name instead of
populating structure like I should have.  Moral: I should engage brain
before opening mouth :)

-Justin Scott, Lead Developer
 Sceiron Internet Services, Inc.
 http://www.sceiron.com


- Original Message -
From: Pascal Peters [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Thursday, April 11, 2002 10:36 AM
Subject: RE: Dynamic structure key names


 You're a brave man, going against Ray on his favorite toppic. If you have
a closer look, you will see that Ray is (of course) right and you are wrong.
No quotes or # signs needed. In general, try to avoid them when you don't
need them.

 Pascal Peters
 Certified ColdFusion (5.0) Advanced Developer
 Certified Web Developer
 Macromedia Certified Instructor
 LR Technologies, Belgium
 Tel +32 2 639 68 70
 Fax +32 2 639 68 99
 Email [EMAIL PROTECTED]
 Web www.lrt.be

 -Original Message-
 From: Justin Scott [mailto:[EMAIL PROTECTED]]
 Sent: donderdag 11 april 2002 16:26
 To: CF-Talk
 Subject: Re: Dynamic structure key names


 Actually, you do need them when setting a dynamic variable in this way.
You
 could use the setVariable() function to avoid using the quotes and pounds,
 however.

 -Justin Scott, Lead Developer
  Sceiron Internet Services, Inc.
  http://www.sceiron.com


 - Original Message -
 From: Raymond Camden [EMAIL PROTECTED]
 To: CF-Talk [EMAIL PROTECTED]
 Sent: Thursday, April 11, 2002 9:59 AM
 Subject: RE: Dynamic structure key names


  
   cfset payment.due[#pkWebUser#] = structNew()
  
  
 
  No need for quotes or for # signs.
 
  cfset payment.due[pkWebUser] = structNew()
 
  ===
  Raymond Camden, Principal Spectra Compliance Engineer for Macromedia
 
  Email: [EMAIL PROTECTED]
  Yahoo IM : morpheus
 
  My ally is the Force, and a powerful ally it is. - Yoda
 
 

 
__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Dynamic structure key names

2002-04-11 Thread Raymond Camden

It's ok - since I got this one right, I can guarantee (with 100%
accuracy) that my next response will be so wrong it will cause your CF
server to melt. :

===
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

Email: [EMAIL PROTECTED]
Yahoo IM : morpheus

My ally is the Force, and a powerful ally it is. - Yoda 

 -Original Message-
 From: Justin Scott [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, April 11, 2002 10:39 AM
 To: CF-Talk
 Subject: Re: Dynamic structure key names
 
 
 Yeah..  I looked at it and thought dynamic variable name instead of
 populating structure like I should have.  Moral: I should 
 engage brain
 before opening mouth :)
 

__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Dynamic structure key names

2002-04-11 Thread Sharon Diorio

I'm jumping in late on this one, but I wanted to throw in my two cents.

Structures (and arrays) are *so* much easier in cfscript, it's not even funny.

cfset payment = structNew()
cfloop query=queryName
cfscript
if (NOT structKeyExists(payment, pkWebUser) {
payment[pkWebUser] = structNew();
}
/cfscript
/cfloop

Throwing in the if statement prevents the structure from being overwritten if there 
are duplicate records in the query.  This way you can make nested structures much 
easier.

(In case nobody else pointed it out, you don't need the dot when using the array 
notation.)

Sharon
- Original Message - 
From: Kay Smoljak [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Thursday, April 11, 2002 5:11 AM
Subject: Dynamic structure key names


 Hi all,
 
 I'm stuck on the syntax for this. I have a structure. What I'm trying to
 do is loop over a query, and create a new structure (dynamically named
 with the primary key of the record as a structure key) with three values
 from that record. I think I must be doing something wrong syntax-wise,
 and I can't find any examples in the docs or the archives.
 
 I have tried these (within a query loop):
 cfset payment.[due.pkWebUser] = StructNew()
 cfset payment.evaluate(due.pkWebUser) = StructNew()
 cfset payment.#due.pkWebUser# = StructNew()
 
 But nothing is working so far. Any ideas on how to do this or how it can
 be done easier?
 
 Kay.
 
 __
 Kay Smoljak - ColdFusion Developer - PerthWeb Pty Ltd
 
 Level 9/105 St George's Terrace - Perth - Western Australia
 Ph: (08) 9226 1366 Fax: (08) 9226 1375 www.perthweb.com.au
 
 http://developer.perthweb.com.au - Tools for Developers
 cfx_pwcamtech | cfx_pwimageproc | cfx_pwcardcyrpt
 
 
 
 
 
 
__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists