that's great, James, many thanks, that fixed it.

Jenny


-----Original Message-----
From: James Holmes [mailto:[EMAIL PROTECTED]
Sent: 17 August 2006 06:56
To: CF-Talk
Subject: Re: Array Syntax


This is easier to understand if you don't use evaluate().

Refer to the form variables directly. The form scope is a struct, so
StructKeyExists will tell you if a particular form var is there.

<cfif StructKeyExists(FORM,"Astockid" & i)>...

Also, you can refer to it in struct notation:

<cfoutput>FORM["Astockid" & i]</cfoutput>

etc.

On 8/17/06, Jenny Gavin-Wear <[EMAIL PROTECTED]> wrote:
> Hi Alan,
>
> Thanks for the reply.  You are right, I was going about things the wrong way 
> and am on the right track now I hope.
>
> Weird thing with the code below, i've stepped through the code and the form 
> variables do exist but it crashes on the evalute line for the Ostockid.
>
> Any ideas, please?
>
>
> <cfoutput>
> <cfloop from ="#startrow_stock#" to ="#endrow_stock#" index="i">
> <CFSET Ostockid="form.Astockid" & i>
> <cfif isdefined("ostockid")>
> <CFSET Oquantity="form.AQuantity" & i>
> <CFSET Oinout ="form.Ainout" & i>
> <cfset stockid = #evaluate(OstockID)#>
> <cfset quantity = #evaluate(Oquantity)#>
> <cfset inout = #evaluate(Oinout)#>
> <cfif quantity gt 0>
> #stockid# / #quantity# / #inout#
> </cfif>
> </cfif>
> </cfloop>
> <cfabort>
> </cfoutput>
>
>
>
>
> -----Original Message-----
> From: Alan Rother [mailto:[EMAIL PROTECTED]
> Sent: 17 August 2006 04:55
> To: CF-Talk
> Subject: Re: Array Syntax
>
>
> Offhand I see a few things.
>
> First, you can't use IsDefined on an array like that
>
> IsDefined("Form.MyArray[1][1]")
>
> You can only check for the existence of the main variable
>
> IsDefined("Form.MyArray")
>
> Second, you dont need the #'s in this part, form.Astockid[1][#i#] NEQ ""
>
> Last, why are you setting an array into the form scope? I tested it and it
> does work, but I would consider it "wrong", so I am curious why you are
> using it.
>
>
> Could you possibly give me a larger sample of what you are working on? I'd
> be happy to show you the right way to do it, but I'm confused about what I
> am seeing so far.
>
> --
> Alan Rother
> Macromedia Certified Advanced ColdFusion MX 7 Developer
>
>
>
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250131
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to