Sorry about the delay in getting back to this thread...
First, thanks, Sean for the suggestion to use structKeyList() although
it doesn't quite give me what I want.
Brian and James had some valid questions, so let me answer them:
As far as not passing the payOptionID, I could do that (and eventually
do use that when I store the order data). I actually need to pass both
the payOptionID and payOption values to the action page (due to some
conditional processing depending on what the user selects as their
payment option). I figured it would be just as easy to do a lookup in
the structure (or array if I went that route) to get the associated key
value.
I need to correct my initial post. For simplicity, I laid out the ID
keys as sequential in my post but in reality they are not sequential in
the database. The data is actually stored as:
(stEventPayOptions.PayOptionID, stEventPayOptions.PayOption)
1, Cash or Check
2, Credit Card
4, Invoice
8, Gift Card
So, sorry for the confusion.
The reason I initially decided to go with a structure is as Brian
mentioned below - because the keys aren't sequential and I thought using
a structure might be best for that. I am now rethinking this and may use
an array. I am moving the database from MS Access to MySQL and it would
be trivial to reset the keys to sequential order when I convert that
table. But going back to my decision to use a structure to store the
payOptions and payOptionIDs, I was looking for a way to reach directly
into the structure and pull out the payOptionID if I had a known
associated payOption. I was able to do this by using a collection loop
over the structure to give me what I wanted.
Thanks, guys!
Brian Kotek said the following on 5/27/2007 2:30 PM:
> With an ID as the key you can easily pull things out of the struct. It's
> quite different from an array because the keys can be any number you need,
> not just sequential as they are in an array.
>
> On 5/26/07, James Holmes <[EMAIL PROTECTED]> wrote:
>> I was wondering why anyone would have a structure with numbers as
>> keys, which is essentially the same as an array (but without the power
>> of all of the array functions).
>>
>> On 5/27/07, Brian Kotek <[EMAIL PROTECTED]> wrote:
>>> Also, just wondering why you'd be passing around the payOption
>> ("invoice")
>>> instead of the far more useful payOptionID (4)?
>>>
>>> On 5/25/07, Sean Corfield <[EMAIL PROTECTED]> wrote:
>>>> structKeyList()
--
Best regards,
Chris Montgomery
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279393
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4