Kris

        Let me recap so I am with you on this.
        You want to dynamically create a form with the information passed
back to the client page
        You can add a little DHTML with the FusionScript:
        This will create a table to display your records, 
        You can should beable to adopt it to your needs
        This is type on the moment so you need review for typos
        
        <cf_fs_function name="adddist">
        
                <cf_fs_activeserver action="call"
                        page="adddist.cfm"
                        district="form.new"
                        username="form.username"
                        password="form.password">
                        form.new = DIST;
                        form.username = PASS;
                        form.password = USER;
                <cf_fs_convert name="startTable">
                        <table border="1" width="100%" bgcolor="#cccccc">
                </cf_fs_convert>

                <cf_fs_convert name="startTitle">
                        <th bgcolor="#0000FF">
                </cf_fs_convert>                

                <cf_fs_convert name="endTitle">
                        </th>
                </cf_fs_convert>                
                
                <cf_fs_convert name="startRow">
                        <tr>
                </cf_fs_convert>

                <cf_fs_convert name="startCell">
                        <td align="center" nowrap bgcolor="#FFFFFF">
                </cf_fs_convert>
                
                <cf_fs_convert name="startCellExpand">
                        <td bgcolor="#ffffff" colspan="8">
                </cf_fs_convert>
                
                <cf_fs_convert name="endCell">
                        </td>
                </cf_fs_convert>

                <cf_fs_convert name="endRow">
                        </tr>
                </cf_fs_convert>

                <cf_fs_convert name="endTable">
                        </table>
                </cf_fs_convert>

                <cf_fs_convert name="startDiv">
                        <DIV style="OVERFLOW-y: auto; WIDTH: 100%; HEIGHT:
300">
                </cf_fs_convert>
        
                <cf_fs_convert name="endDiv">
                        </div>
                </cf_fs_convert>


                Mytable = "";
                Mytable= Mytable + startTable;
                Mytable= Mytable + startRow;
                Mytable= Mytable + startTitle;
                Mytable = Mytable + "1.  PK ID";
                Mytable = Mytable + endTitle;
                Mytable = Mytable + startTitle;
                Mytable = Mytable + "2.  Actions ID";
                Mytable = Mytable + endTitle;
                Mytable = Mytable + endRow;
                
                <cf_fs_loop from="0" to="(arrayLen(DistData)-1)" index="x">
                        Mytable = Mytable +startRow;
                        Mytable = Mytable + startCell + DistData[x][0] +
endCell;
                        Mytable = Mytable + startCell + DistData[x][1] +
endCell;
                        Mytable = Mytable + startCell + DistData[x][2] +
endCell;
                        Mytable = newtable + startCell + DistData[x][3] +
endCell;
                        Mytable = Mytable + startCell + DistData[x][4] +
endCell;
                        Mytable = Mytable + endRow;
                </cf_fs_loop>
                Mytable = Mytable + endTable;
                Mytable = Mytable + endDiv;
                                
                <!--- Display to browser --->
           if( browserVersion() == 'NS4' ) {
                document.layers.mydiv.document.write(newtable);
                  } else {
                document.all.mydiv.innerHTML = newtable;
                  }
                
        </cf_fs_function>

<BODY>

<DIV id="mydiv">
<!----table will display here------>
</Div>

</body>

Does this help?
ROdney


-----Original Message-----
From: Kris Pilles [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 27, 2002 9:06 AM
To: CF-Talk
Subject: RE: Dynamic Array Help


Rodney:

I have created and array and I'm sending it back to my client page via
activeserver....

Now, I have this array 2 dimensional and I don't know how to take all
the data (which is just my query results) and read it so that I can
break it down into records and populate my form.  

Basically we've been working with fusionscrtipt a little and we're
trying to see how powerful it is... I ahd this form working with 1
record per section however we want to be bale to return multiple records
for each category.

I will attach the code but it's a simple chart down the left side are
grades k,1,2,3,4,5 across the top are sciences Life, Earth, Physical.
Now underneath each area, we want the ability to have multip results.
For example.  I would like 2 have 2 grade K life science events.  Each
event consists of an Action (which is also a dorp down) and event (text
box) and when (text box of when it occurred).  So, we need to have the
ability to read through the array, and break it up then have it display
all the data in the correct locations...  I know this is kind of jumbled
but do you follow me at all??

Action page:

<cf_fs_activeserver action="getAttributes">
<cfquery name="getinfo" datasource="oll">
select * 
from events
where did = '#activeserver.district#'
</cfquery>
<cfif getinfo.recordcount>
<!--- Declare the array --->

<CFSET DistData=ArrayNew(2)>

<!--- Populate the array row by row --->

<CFLOOP QUERY="getinfo">
<!---The item structure we are going to use to store the items 
                        // is going to have seven parts...
                        //              1.  PK ID
                        //              2.  Actions ID
                        //              3.  Title
                        //              4.  Description
                        //              5.  District ID
                        //              6.  Grade
                        //              7.  Science--->
<CFSET DistData[CurrentRow][1]=getinfo.id[CurrentRow]>
<CFSET DistData[CurrentRow][2]=getinfo.AID[CurrentRow]>
<CFSET DistData[CurrentRow][3]=getinfo.Title[CurrentRow]>
<CFSET DistData[CurrentRow][4]=getinfo.Description[CurrentRow]>
<CFSET DistData[CurrentRow][5]=getinfo.DID[CurrentRow]>
<CFSET DistData[CurrentRow][6]=getinfo.Grade[CurrentRow]>
<CFSET DistData[CurrentRow][7]=getinfo.Science[CurrentRow]>
</CFLOOP>
<!--- Return the Array --->
<cf_fs_activeServer action="return" type="ARRAY" name="DistData"
value="#DistData#">


Main Page: (minus html)

<cf_fusionscript action="code">

        <cf_fusionscript action="libraries">
        form.*
        </cf_fusionscript>
        <cf_fs_function name="adddist">
        
                <cf_fs_activeserver action="call"
                        page="adddist.cfm"
                        district="form.new"
                        username="form.username"
                        password="form.password">
                        form.new = DIST;
                        form.username = PASS;
                        form.password = USER;
        </cf_fs_function>
        <cf_fs_function name="deldist">
        
                <cf_fs_activeserver action="call"
                        page="deldist.cfm"
                        district="form.district">
                        dist = DIST;
                        
        </cf_fs_function>
        <cf_fs_function name="getdist">
        
                <cf_fs_activeserver action="call"
                        page="getdist.cfm"
                        district="form.district">
                        DistData = DistData;
                        
        <cfquery
        </cf_fs_function>
</cf_fusionscript>

So, I don't know where to go form here....




-----Original Message-----
From: Bruce, Rodney S HQISEC/SIGNAL
[mailto:[EMAIL PROTECTED]] 
Sent: Thursday, June 27, 2002 11:23 AM
To: CF-Talk
Subject: RE: Dynamic Array Help


Kris

        If you are using Fusionscript, which I think you mentioned.
There is a Fusionscript list as well.
        You can go to www.fusionscript.com to join.     
But here is how I am returning my query results from the server page to
the calling (client page)

                <!-----Server Page----------->
                <Query>
                        Get info
                </Query>

        <CFIF Query.recordcount>
        <CFSCRIPT>
                <!---returns one record--------------->
                myarray =arraynew(1);
                myarray [1] = Query.Value1; 
                myarray [2] = Query.Value2; 
                myarray [3] = Query.Value3; 
                myarray [4] = Query.Value4; 
                myarray [5] = Query.Value5; 
                 
                <!---If you want all records--------------->
                Myarray = arraynew(2);
                control = query.recordcount +1;
                start = 1;
                while (start LT control){
                        myarray[start][1] = Query.value1[start];
                        myarray[start][2] = Query.value2[start];
                        start = start +1;
                        }
        </CFSCRIPT>

        <cf_fs_activeServer action="return" name="returnarray"
value="#myarray#" type="array">

        <!----Client page,  remember CF starts arrays at 1 , Javascript
at
-------->
        <!-----inside the Fusionscript Funtion----------------->
                <!---for 1D array---->
                form.field1 = returnarray[0];
                form.field2 = returnarray[1];
                form.field3 = returnarray[2];
                form.field4 = returnarray[3];
                form.field5 = returnarray[4];
                
                <!---for 2d array------->
                <!---Normaly I use this for populating select lists---->
                <cf_fs_loop from="0" to="arrayLen(returnarray)-1"
index="i">

                <cf_fs_select action="addOption"
                        field="'selectfieldname'"
                        value="returnarray[i][0]"
                        text="returnarray[i][1]">
                </cf_fs_loop>

Let me know if this is what you were looking or has my caffeine not
kicked in yet ;o)

Rodney

-----Original Message-----
From: Kris Pilles [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 27, 2002 7:53 AM
To: CF-Talk
Subject: RE: Dynamic Array Help


Ok.... I've got my array.... However.... Now, I sent it back to where it
needs to go... How do I take the data within the array and basically
query it so I can sort it so I can parse the records out to populate my
form???

-----Original Message-----
From: Andrew Scott [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, June 27, 2002 10:23 AM
To: CF-Talk
Subject: RE: Dynamic Array Help


As in

<cfset array.ID = ArrayNew(1)>
<cfset array.AID = ArrayNew(1)>

<cfset array.ID[count] = value>


-----Original Message-----
From: Kris Pilles [mailto:[EMAIL PROTECTED]] 
Sent: Friday, 28 June 2002 12:16 AM
To: CF-Talk
Subject: Dynamic Array Help

Haven't written a dynamic array in a while and need some help..... I
think ive forgotten how to...

Heres the column names.... 

ID
AID
Title
Description
DID
Grade
Science


Can someone tell me how to create a dynamic array... I need to store my
query results in an array so I can ship it through my API...

Thanks.





______________________________________________________________________
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

Reply via email to