Thanks to those who responded. This does fix it. Knew that, forgot it, need to 
get it tattooed on me somewhere. 


 

-----Original Message-----
From: I. Addoum. [mailto:[email protected]] 
Sent: Friday, February 05, 2010 9:58 AM
To: cf-talk
Subject: Re: Arrays - humbug! - Part 1


@larry


try [1st dim][2nd dim] instead of [a,b]

<cfset SESSION.Report.Lats[#a#][1] = latID>  


regards
Bob



________________________________
From: "Stephens, Larry V" <[email protected]>
To: cf-talk <[email protected]>
Sent: Fri, February 5, 2010 4:06:48 PM
Subject: Arrays - humbug! - Part 1


For some reason I have a mental block when it comes to arrays.

At the top of the page is:  <cfset SESSION.Report = StructNew()>

I pull info (if it exists) with a query:
    <cfquery name="GetLats" datasource="#SESSION.ds#">
        SELECT tblLaterals.latID, 
                tblLaterals.lateralID, 
                tblLaterals.Why, 
                [FirstName] & Chr(32) & [LastName] AS Who, 
                tblPlayers.Title, 
                tblPlayers.TX, 
                tblPlayers.FAX, 
                tblPlayers.Email,
                tblLaterals.DateSent
        FROM tblLaterals LEFT JOIN tblPlayers ON tblLaterals.lateralID = 
tblPlayers.playerID
        WHERE tblLaterals.MasterID=#SESSION.Report.MasterID#
        ORDER BY [FirstName] & Chr(32) & [LastName];
    </cfquery>

I then want to store it in an array. This is a new database so I have nothing 
to store, yet, i.e., the inner code hasn't been tested.

    <cfset SESSION.Report.Lats = ArrayNew(2)>
    <cfif GetLats.Recordcount GT 0>  <!--- a lateral is the head of a unit you 
are reporting on --->

        
        <cfset a = ArrayNew(1)>
        <!---<cfset a = 1>--->
        <cfoutput query="GetLats">

            <!---<cfset SESSION.Report.Lats[#a#,1] = latID>  
            <cfset SESSION.Report.Lats[#a#,2] = lateralID> 
            <cfset SESSION.Report.Lats[#a#,3] = Why>
            <cfset SESSION.Report.Lats[#a#,4] = Who>
            <cfset SESSION.Report.Lats[#a#,5] = Title>
            <cfset SESSION.Report.Lats[#a#,6] = TX>
            <cfset SESSION.Report.Lats[#a#,7] = FAX>
            <cfset SESSION.Report.Lats[#a#,8] = Email>
            <cfset SESSION.Report.Lats[#a#,9] = DateSent>
            <cfset a = a + 1>--->
            
            <cfset a[1] = latID>
            <cfset a[2] = lateralID>
            <cfset a[3] = Why>
            <cfset a[4] = Who>
            <cfset a[5] = Title>
            <cfset a[6] = TX>
            <cfset a[7] = FAX>
            <cfset a[8] = Email>
            <cfset a[9] = DateSent>
            <cfset ArrayAppend(SESSION.Report.Lats, a)>
        </cfoutput>

    </cfif>

Here's the first problem. Looking inside the <cfif> statement, the code that is 
commented out throws an error. i.e.,

    <cfset SESSION.Report.Lats = ArrayNew(2)>
    <cfif GetLats.Recordcount GT 0>  <!--- a lateral is the head of a unit you 
are reporting on --->

        
        
        <cfset a = 1>
        <cfoutput query="GetLats">

            <cfset SESSION.Report.Lats[#a#,1] = latID>  
            <cfset SESSION.Report.Lats[#a#,2] = lateralID> 
            <cfset SESSION.Report.Lats[#a#,3] = Why>
            <cfset SESSION.Report.Lats[#a#,4] = Who>
            <cfset SESSION.Report.Lats[#a#,5] = Title>
            <cfset SESSION.Report.Lats[#a#,6] = TX>
            <cfset SESSION.Report.Lats[#a#,7] = FAX>
            <cfset SESSION.Report.Lats[#a#,8] = Email>
            <cfset SESSION.Report.Lats[#a#,9] = DateSent>
            <cfset a = a + 1>
            
        </cfoutput>
    </cfif>

won't work. I tried #a# with and without the hash marks. My intent is to have 
[1,1], [1,2] ... [1,9], [2,1], [2,2] etc. I'm missing something.

The code as is (i.e., setting up array a then ArrayAppending it hasn't run yet 
but at least doesn't throw an invalid construct error.

To keep this from getting too long I'm stopping here. Continuing in next 
message.

Larry Stephens
[email protected]





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330440
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