2 session arrays combined into 1

2011-08-10 Thread Akos Fortagh

Hi everyone, I'm stuck on this and it must be so simple but can't get my head 
round it.

I have 2 different shopping cart arrays going at the same time because some 
products are handled differently to 'normal' products, know it's unusual but 
this is how it had to be. I also need to have a 3rd cart array which combines 
all items form Cart 1 and Cart 2 into 1 single array.
Each cart array is actually a new structure to hold items with ItemName and 
ItemID.
Is it possible to 'dynamically' populate cart 3 with the contents of cart 1 and 
2 so if I add an item to cart 1 it'll automatically be shown in cart 3, or if I 
add one to Cart 2 it'll also be shown in cart 3.
All these arrays with structures are store in SESSION.
Hope that all makes sense.
Any help would be greatly appreciated. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346654
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


CF 9, WebService, arrays, and objects

2011-05-05 Thread Douglas Knudsen

So, I have this method setup

remote com.foo.StateDTO[] function getAllStates() {}

1) if I invoke via web browser via
http://myurl/myservice.cfc?wsdlmethod=getAllStates
it works a treat
2) if I use cfinvoke method=getAllStates webservice=
http://myurl/myservice.cfc?wsdl;  I get the below error
3) if I use Flex to hit the WSDL, I get the same error

Now, reading in docs and a few blogs, returning a typed array is supposed to
work, but it ain't captain!  Any hints or thoughts?

If I replace the return type with array, it all works, but hey, the WSDL
says its any type.

The error:

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: coldfusion.xml.rpc.CFCInvocationException:
[java.lang.ClassCastException : java.util.ArrayList]
 faultActor:
 faultNode:
 faultDetail:

{http://xml.apache.org/axis/}stackTrace:coldfusion.xml.rpc.CFCInvocationException:
[java.lang.ClassCastException : java.util.ArrayList]
at 
coldfusion.xml.rpc.CFComponentSkeleton.__createCFCInvocationException(CFComponentSkeleton.java:733)
at 
coldfusion.xml.rpc.CFComponentSkeleton.__cast(CFComponentSkeleton.java:409)
at 
cfobjective.CFOFacade.getAllStates(/Servers/apache-tomcat-6.0.26_CF9_64bit_cfo/webapps/ROOT/myservice.cfc)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis.providers.java ''





Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344256
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Storing Arrays or Structures in a database

2011-04-07 Thread Raymond Camden

Not if any value has a comma in it. You can use other delimiters, but
then you just have a different problem.

On Wed, Apr 6, 2011 at 4:38 PM, Bobby Hartsfield bo...@acoderslife.com wrote:

 Assuming you are dealing with one dimensional arrays, sure, converting it to
 a list could work.

 .:.:.:.:.:.:.:.:.:.:.:.:.:.


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343596
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Storing Arrays or Structures in a database

2011-04-07 Thread Bobby Hartsfield

Hence the could. There are plenty of wrenches to throw into it (like the
delimiter character being used as a normal character in one of the values).

.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
http://cf4em.com

-Original Message-
From: Raymond Camden [mailto:rcam...@gmail.com] 
Sent: Thursday, April 07, 2011 9:43 AM
To: cf-talk
Subject: Re: Storing Arrays or Structures in a database


Not if any value has a comma in it. You can use other delimiters, but
then you just have a different problem.

On Wed, Apr 6, 2011 at 4:38 PM, Bobby Hartsfield bo...@acoderslife.com
wrote:

 Assuming you are dealing with one dimensional arrays, sure, converting it
to
 a list could work.

 .:.:.:.:.:.:.:.:.:.:.:.:.:.




~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343604
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Storing Arrays or Structures in a database

2011-04-06 Thread Adam Bourg

I've got really large sets of data that are related to each day of the week and 
the hour. Rather then creating a massive table containing these values, I have 
stored them in a Structure, but I can't seem to get Structures or Arrays to 
insert into a database. How can I store an array or structure in a MS 2008 SQL 
server? 

Array Code: 

cfset name=Adam / 
cfscript
// 7 days, day 0 = Mon, Day 7 = sun
workWeek=[t,t,f,t,f,t,f];
/cfscript

cfinvoke method=injectData component=anubis 
cfinvokeargument name=name value=#name# /
cfinvokeargument name=workWeek value=#workWeek# /
/cfinvoke

cffunction name=injectData access=public returntype=void hint=Injects 
the Employee App form data

cfquery datasource=DSN name=insertData
INSERT INTO mod_employmentAppProfile(
name, 
workWeekendsEvenings
)
VALUES ( 
#ARGUMENTS.name#,
#ARGUMENTS.workWeek#
) 
/cfquery



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343572
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Storing Arrays or Structures in a database

2011-04-06 Thread Michael Grant

Serialize them as JSON or WDDX and store them as text.

On Wed, Apr 6, 2011 at 1:41 PM, Adam Bourg adam.bo...@gmail.com wrote:


 I've got really large sets of data that are related to each day of the week
 and the hour. Rather then creating a massive table containing these values,
 I have stored them in a Structure, but I can't seem to get Structures or
 Arrays to insert into a database. How can I store an array or structure in a
 MS 2008 SQL server?

 Array Code:

 cfset name=Adam /
 cfscript
 // 7 days, day 0 = Mon, Day 7 = sun
 workWeek=[t,t,f,t,f,t,f];
 /cfscript

 cfinvoke method=injectData component=anubis
cfinvokeargument name=name value=#name# /
cfinvokeargument name=workWeek value=#workWeek# /
 /cfinvoke

 cffunction name=injectData access=public returntype=void
 hint=Injects the Employee App form data

 cfquery datasource=DSN name=insertData
 INSERT INTO mod_employmentAppProfile(
name,
workWeekendsEvenings
 )
 VALUES (
#ARGUMENTS.name#,
#ARGUMENTS.workWeek#
 )
 /cfquery



 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343573
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Storing Arrays or Structures in a database

2011-04-06 Thread John M Bliss

cfwddx action=cfml2wddx input=#ARGUMENTS.workWeek#
output=wddxworkWeek

On Wed, Apr 6, 2011 at 12:41 PM, Adam Bourg adam.bo...@gmail.com wrote:


 I've got really large sets of data that are related to each day of the week
 and the hour. Rather then creating a massive table containing these values,
 I have stored them in a Structure, but I can't seem to get Structures or
 Arrays to insert into a database. How can I store an array or structure in a
 MS 2008 SQL server?

 Array Code:

 cfset name=Adam /
 cfscript
 // 7 days, day 0 = Mon, Day 7 = sun
 workWeek=[t,t,f,t,f,t,f];
 /cfscript

 cfinvoke method=injectData component=anubis
cfinvokeargument name=name value=#name# /
cfinvokeargument name=workWeek value=#workWeek# /
 /cfinvoke

 cffunction name=injectData access=public returntype=void
 hint=Injects the Employee App form data

 cfquery datasource=DSN name=insertData
 INSERT INTO mod_employmentAppProfile(
name,
workWeekendsEvenings
 )
 VALUES (
#ARGUMENTS.name#,
#ARGUMENTS.workWeek#
 )
 /cfquery



 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343574
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


re: Storing Arrays or Structures in a database

2011-04-06 Thread Jason Fisher

Serialize with WDDX or JSON, I would say.  Those are complex variable types 
which need to be serialized into strings before insertion into a DB.



From: Adam Bourg adam.bo...@gmail.com
Sent: Wednesday, April 06, 2011 1:49 PM
To: cf-talk cf-talk@houseoffusion.com
Subject: Storing Arrays or Structures in a database

I've got really large sets of data that are related to each day of the week 
and the hour. Rather then creating a massive table containing these values, 
I have stored them in a Structure, but I can't seem to get Structures or 
Arrays to insert into a database. How can I store an array or structure in 
a MS 2008 SQL server? 

Array Code: 

cfset name=Adam / 
cfscript
// 7 days, day 0 = Mon, Day 7 = sun
workWeek=[t,t,f,t,f,t,f];
/cfscript

cfinvoke method=injectData component=anubis 
cfinvokeargument name=name value=#name# /
cfinvokeargument name=workWeek value=#workWeek# /
/cfinvoke

cffunction name=injectData access=public returntype=void 
hint=Injects the Employee App form data

cfquery datasource=DSN name=insertData
INSERT INTO mod_employmentAppProfile(
name, 
workWeekendsEvenings
)
VALUES ( 
#ARGUMENTS.name#,
#ARGUMENTS.workWeek#
) 
/cfquery



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343575
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Storing Arrays or Structures in a database

2011-04-06 Thread Jeff Garza

Arrays are easy as you can simply use Arraytolist() to convert it to a
delimited text string and then use ListtoArray() to convert back once you
get it out.  Though, CF has some really nice list functions, so you might
not even have to do that.  Also, select boxes return comma separated lists
back to CF when a form is submitted (ditto for checkboxes with the same
name)... So that might work in your favor.  

For structures though, WDDX is your friend, and quite easy to do...

Try cfwddx action=CFML2WDDX input=#workweek# output=workweekXML

Then stuff workweekXML into the database field.

When you retrieve the data back out of the database, use cfwddx again to
convert back to a CF structure

cfwddx action=WDDX2CFML input=queryname.databaseWDDXField
output=localStructVariable

Just make sure that your db field can handle a decent sized chunk of data,
especially if  you are allowing user defined data in this column as the WDDX
format can get kinda bloated.


-Original Message-
From: Adam Bourg [mailto:adam.bo...@gmail.com] 
Sent: Wednesday, April 06, 2011 10:41 AM
To: cf-talk
Subject: Storing Arrays or Structures in a database


I've got really large sets of data that are related to each day of the week
and the hour. Rather then creating a massive table containing these values,
I have stored them in a Structure, but I can't seem to get Structures or
Arrays to insert into a database. How can I store an array or structure in a
MS 2008 SQL server? 

Array Code: 

cfset name=Adam /
cfscript
// 7 days, day 0 = Mon, Day 7 = sun
workWeek=[t,t,f,t,f,t,f];
/cfscript

cfinvoke method=injectData component=anubis 
cfinvokeargument name=name value=#name# /
cfinvokeargument name=workWeek value=#workWeek# /
/cfinvoke

cffunction name=injectData access=public returntype=void
hint=Injects the Employee App form data

cfquery datasource=DSN name=insertData INSERT INTO
mod_employmentAppProfile(
name, 
workWeekendsEvenings
)
VALUES ( 
#ARGUMENTS.name#,
#ARGUMENTS.workWeek#
)
/cfquery





~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343576
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Storing Arrays or Structures in a database

2011-04-06 Thread Carl Von Stetten

Keep in mind that WDDX adds quite a bit of extra stuff around your 
data as compared to JSON.  For example, take this ColdFusion array:

cfset myArray = [John,Paul,George,Ringo]

Here is the serialized JSON version:

[John,Paul,George,Ringo]

Here is the WDDX version:

wddxPacket version='1.0'header/dataarray 
length='4'stringJohn/stringstringPaul/stringstringGeorge/stringstringRingo/string/array/data/wddxPacket

The larger the array or structure, the bigger the bloat from WDDX, and 
the more database space required to store it.  This needs to be 
considered when designing your database columns.

HTH,
Carl

On 4/6/2011 10:52 AM, Michael Grant wrote:
 Serialize them as JSON or WDDX and store them as text.

 On Wed, Apr 6, 2011 at 1:41 PM, Adam Bourgadam.bo...@gmail.com  wrote:

 I've got really large sets of data that are related to each day of the week
 and the hour. Rather then creating a massive table containing these values,
 I have stored them in a Structure, but I can't seem to get Structures or
 Arrays to insert into a database. How can I store an array or structure in a
 MS 2008 SQL server?

 Array Code:

 cfset name=Adam /
 cfscript
 // 7 days, day 0 = Mon, Day 7 = sun
 workWeek=[t,t,f,t,f,t,f];
 /cfscript

 cfinvoke method=injectData component=anubis
 cfinvokeargument name=name value=#name# /
 cfinvokeargument name=workWeek value=#workWeek# /
 /cfinvoke

 cffunction name=injectData access=public returntype=void
 hint=Injects the Employee App form data

 cfquery datasource=DSN name=insertData
 INSERT INTO mod_employmentAppProfile(
 name,
 workWeekendsEvenings
 )
 VALUES (
 #ARGUMENTS.name#,
 #ARGUMENTS.workWeek#
 )
 /cfquery




 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343577
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Storing Arrays or Structures in a database

2011-04-06 Thread John Blayter

Another way to do it is to serialize the object in a base64 string.
I've had some great success using this method to persist complex
objects to the database.

cfscript
function serializeObject(object){
var local   = structNew();
local.byteOut   = createObject(java, java.io.ByteArrayOutputStream);
local.byteOut.init();
local.objOut= createObject(java, java.io.ObjectOutputStream);
local.objOut.init(local.byteOut);
local.objOut.writeObject(arguments.object);
local.objOut.close();
return toBase64(local.byteOut.toByteArray());
}

function deserializeObject(objectString){
var local = structNew();
local.inputStream = createObject(java, 
java.io.ByteArrayInputStream);
local.objIn = createObject(java, java.io.ObjectInputStream);
local.returnObj = ;
local.inputStream.init(toBinary(arguments.objectString));
local.objIn.init(local.inputStream);
local.returnObj = local.objIn.readObject();
local.objIn.close();
return local.returnObj;
}
/cfscript

I've been using this in http://sessionswap.riaforge.org/ for a long time.


John Blayter
Land line: 303.731.3009
Mobile: 303.325.1979
http://www.blayter.com/john/

Denver ColdFusion User Group Manager
http://denvercfug.org/



On Wed, Apr 6, 2011 at 12:02 PM, Jeff Garza j...@garzasixpack.com wrote:

 Arrays are easy as you can simply use Arraytolist() to convert it to a
 delimited text string and then use ListtoArray() to convert back once you
 get it out.  Though, CF has some really nice list functions, so you might
 not even have to do that.  Also, select boxes return comma separated lists
 back to CF when a form is submitted (ditto for checkboxes with the same
 name)... So that might work in your favor.

 For structures though, WDDX is your friend, and quite easy to do...

 Try cfwddx action=CFML2WDDX input=#workweek# output=workweekXML

 Then stuff workweekXML into the database field.

 When you retrieve the data back out of the database, use cfwddx again to
 convert back to a CF structure

 cfwddx action=WDDX2CFML input=queryname.databaseWDDXField
 output=localStructVariable

 Just make sure that your db field can handle a decent sized chunk of data,
 especially if  you are allowing user defined data in this column as the WDDX
 format can get kinda bloated.


 -Original Message-
 From: Adam Bourg [mailto:adam.bo...@gmail.com]
 Sent: Wednesday, April 06, 2011 10:41 AM
 To: cf-talk
 Subject: Storing Arrays or Structures in a database


 I've got really large sets of data that are related to each day of the week
 and the hour. Rather then creating a massive table containing these values,
 I have stored them in a Structure, but I can't seem to get Structures or
 Arrays to insert into a database. How can I store an array or structure in a
 MS 2008 SQL server?

 Array Code:

 cfset name=Adam /
 cfscript
 // 7 days, day 0 = Mon, Day 7 = sun
 workWeek=[t,t,f,t,f,t,f];
 /cfscript

 cfinvoke method=injectData component=anubis
        cfinvokeargument name=name value=#name# /
    cfinvokeargument name=workWeek value=#workWeek# /
 /cfinvoke

 cffunction name=injectData access=public returntype=void
 hint=Injects the Employee App form data

 cfquery datasource=DSN name=insertData INSERT INTO
 mod_employmentAppProfile(
        name,
        workWeekendsEvenings
 )
 VALUES (
        #ARGUMENTS.name#,
    #ARGUMENTS.workWeek#
 )
 /cfquery





 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343580
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Storing Arrays or Structures in a database

2011-04-06 Thread Bobby Hartsfield

Just talked about this today with a colleague. Convert it to JSON and store
that. When you need to use it, get it from the database and deseralize it.

.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
http://cf4em.com

-Original Message-
From: Adam Bourg [mailto:adam.bo...@gmail.com] 
Sent: Wednesday, April 06, 2011 1:41 PM
To: cf-talk
Subject: Storing Arrays or Structures in a database


I've got really large sets of data that are related to each day of the week
and the hour. Rather then creating a massive table containing these values,
I have stored them in a Structure, but I can't seem to get Structures or
Arrays to insert into a database. How can I store an array or structure in a
MS 2008 SQL server? 

Array Code: 

cfset name=Adam / 
cfscript
// 7 days, day 0 = Mon, Day 7 = sun
workWeek=[t,t,f,t,f,t,f];
/cfscript

cfinvoke method=injectData component=anubis 
cfinvokeargument name=name value=#name# /
cfinvokeargument name=workWeek value=#workWeek# /
/cfinvoke

cffunction name=injectData access=public returntype=void
hint=Injects the Employee App form data

cfquery datasource=DSN name=insertData
INSERT INTO mod_employmentAppProfile(
name, 
workWeekendsEvenings
)
VALUES ( 
#ARGUMENTS.name#,
#ARGUMENTS.workWeek#
) 
/cfquery





~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343584
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Storing Arrays or Structures in a database

2011-04-06 Thread Bobby Hartsfield

Assuming you are dealing with one dimensional arrays, sure, converting it to
a list could work.

.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
http://cf4em.com

-Original Message-
From: Jeff Garza [mailto:j...@garzasixpack.com] 
Sent: Wednesday, April 06, 2011 2:02 PM
To: cf-talk
Subject: RE: Storing Arrays or Structures in a database


Arrays are easy as you can simply use Arraytolist() to convert it to a
delimited text string and then use ListtoArray() to convert back once you
get it out.  Though, CF has some really nice list functions, so you might
not even have to do that.  Also, select boxes return comma separated lists
back to CF when a form is submitted (ditto for checkboxes with the same
name)... So that might work in your favor.  

For structures though, WDDX is your friend, and quite easy to do...

Try cfwddx action=CFML2WDDX input=#workweek# output=workweekXML

Then stuff workweekXML into the database field.

When you retrieve the data back out of the database, use cfwddx again to
convert back to a CF structure

cfwddx action=WDDX2CFML input=queryname.databaseWDDXField
output=localStructVariable

Just make sure that your db field can handle a decent sized chunk of data,
especially if  you are allowing user defined data in this column as the WDDX
format can get kinda bloated.


-Original Message-
From: Adam Bourg [mailto:adam.bo...@gmail.com] 
Sent: Wednesday, April 06, 2011 10:41 AM
To: cf-talk
Subject: Storing Arrays or Structures in a database


I've got really large sets of data that are related to each day of the week
and the hour. Rather then creating a massive table containing these values,
I have stored them in a Structure, but I can't seem to get Structures or
Arrays to insert into a database. How can I store an array or structure in a
MS 2008 SQL server? 

Array Code: 

cfset name=Adam /
cfscript
// 7 days, day 0 = Mon, Day 7 = sun
workWeek=[t,t,f,t,f,t,f];
/cfscript

cfinvoke method=injectData component=anubis 
cfinvokeargument name=name value=#name# /
cfinvokeargument name=workWeek value=#workWeek# /
/cfinvoke

cffunction name=injectData access=public returntype=void
hint=Injects the Employee App form data

cfquery datasource=DSN name=insertData INSERT INTO
mod_employmentAppProfile(
name, 
workWeekendsEvenings
)
VALUES ( 
#ARGUMENTS.name#,
#ARGUMENTS.workWeek#
)
/cfquery







~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343585
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Storing Arrays or Structures in a database

2011-04-06 Thread Jeff Garza

True.  I used wddx to serialize some multidimensional arrays just the other
day...

Jeff 

-Original Message-
From: Bobby Hartsfield [mailto:bo...@acoderslife.com] 
Sent: Wednesday, April 06, 2011 2:39 PM
To: cf-talk
Subject: RE: Storing Arrays or Structures in a database


Assuming you are dealing with one dimensional arrays, sure, converting it to
a list could work.

.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
http://cf4em.com

-Original Message-
From: Jeff Garza [mailto:j...@garzasixpack.com]
Sent: Wednesday, April 06, 2011 2:02 PM
To: cf-talk
Subject: RE: Storing Arrays or Structures in a database


Arrays are easy as you can simply use Arraytolist() to convert it to a
delimited text string and then use ListtoArray() to convert back once you
get it out.  Though, CF has some really nice list functions, so you might
not even have to do that.  Also, select boxes return comma separated lists
back to CF when a form is submitted (ditto for checkboxes with the same
name)... So that might work in your favor.  

For structures though, WDDX is your friend, and quite easy to do...

Try cfwddx action=CFML2WDDX input=#workweek# output=workweekXML

Then stuff workweekXML into the database field.

When you retrieve the data back out of the database, use cfwddx again to
convert back to a CF structure

cfwddx action=WDDX2CFML input=queryname.databaseWDDXField
output=localStructVariable

Just make sure that your db field can handle a decent sized chunk of data,
especially if  you are allowing user defined data in this column as the WDDX
format can get kinda bloated.


-Original Message-
From: Adam Bourg [mailto:adam.bo...@gmail.com] 
Sent: Wednesday, April 06, 2011 10:41 AM
To: cf-talk
Subject: Storing Arrays or Structures in a database


I've got really large sets of data that are related to each day of the week
and the hour. Rather then creating a massive table containing these values,
I have stored them in a Structure, but I can't seem to get Structures or
Arrays to insert into a database. How can I store an array or structure in a
MS 2008 SQL server? 

Array Code: 

cfset name=Adam /
cfscript
// 7 days, day 0 = Mon, Day 7 = sun
workWeek=[t,t,f,t,f,t,f];
/cfscript

cfinvoke method=injectData component=anubis 
cfinvokeargument name=name value=#name# /
cfinvokeargument name=workWeek value=#workWeek# /
/cfinvoke

cffunction name=injectData access=public returntype=void
hint=Injects the Employee App form data

cfquery datasource=DSN name=insertData INSERT INTO
mod_employmentAppProfile(
name, 
workWeekendsEvenings
)
VALUES ( 
#ARGUMENTS.name#,
#ARGUMENTS.workWeek#
)
/cfquery









~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343586
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Storing Arrays or Structures in a database

2011-04-06 Thread Andrew Scott

If anyone is on ColdFusion 8+ then instead of wddx one might use Json
instead, as it has a smaller footprint than WDDX does.

Regards,
Andrew Scott
http://www.andyscott.id.au/

 -Original Message-
 From: Jeff Garza [mailto:j...@garzasixpack.com]
 Sent: Thursday, 7 April 2011 8:10 AM
 To: cf-talk
 Subject: RE: Storing Arrays or Structures in a database
 
 
 True.  I used wddx to serialize some multidimensional arrays just the
other
 day...
 
 Jeff
 


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343587
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Storing Arrays or Structures in a database

2011-04-06 Thread Michael Grant

And you can pass it back and forth between cf and js with no fuss or muss.

On Wed, Apr 6, 2011 at 6:09 PM, Andrew Scott andr...@andyscott.id.auwrote:


 If anyone is on ColdFusion 8+ then instead of wddx one might use Json
 instead, as it has a smaller footprint than WDDX does.

 Regards,
 Andrew Scott
 http://www.andyscott.id.au/

  -Original Message-
  From: Jeff Garza [mailto:j...@garzasixpack.com]
  Sent: Thursday, 7 April 2011 8:10 AM
  To: cf-talk
  Subject: RE: Storing Arrays or Structures in a database
 
 
  True.  I used wddx to serialize some multidimensional arrays just the
 other
  day...
 
  Jeff
 


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343588
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Storing Arrays or Structures in a database

2011-04-06 Thread denstar

On Wed, Apr 6, 2011 at 5:54 PM, Michael Grant wrote:

 And you can pass it back and forth between cf and js with no fuss or muss.


Well, besides the weird is it a string or a number type of deal that
can change 8 to 8.0 and a few other oddities.  ;)

:Den

-- 
It is easier to make a saint out of a libertine than out of a prig.
George Santayana

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343589
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Storing Arrays or Structures in a database

2011-04-06 Thread Andrew Scott

Well I prefer the json.cfc that has been floating around for a while, it
doesn't suffer those problems.

Regards,
Andrew Scott
http://www.andyscott.id.au/


 -Original Message-
 From: denstar [mailto:valliants...@gmail.com]
 Sent: Thursday, 7 April 2011 10:12 AM
 To: cf-talk
 Subject: Re: Storing Arrays or Structures in a database
 
 Well, besides the weird is it a string or a number type of deal that can
 change 8 to 8.0 and a few other oddities.  ;)
 
 :Den
 
 --


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343590
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Storing Arrays or Structures in a database

2011-04-06 Thread Michael Grant

Given. I have a tendency to always use parseInt anyway, so I don't generally
suffer that woe.
However your point is well taken... a teeny bit of fuss, with a pinch of
muss.


On Wed, Apr 6, 2011 at 8:12 PM, denstar valliants...@gmail.com wrote:


 On Wed, Apr 6, 2011 at 5:54 PM, Michael Grant wrote:
 
  And you can pass it back and forth between cf and js with no fuss or
 muss.
 

 Well, besides the weird is it a string or a number type of deal that
 can change 8 to 8.0 and a few other oddities.  ;)

 :Den

 --
 It is easier to make a saint out of a libertine than out of a prig.
 George Santayana

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343591
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Storing Arrays or Structures in a database

2011-04-06 Thread denstar

I was mostly just being pedantic.  :)  It works fine out of the box
most the time.  And for the rest of the time, there's json.cfc, as
Andrew mentioned.  :)

No joke that it's way better than WDDX.  Three cheers for JSON!  Hip, hip, hip!

:den the pelvis uno

-- 
It is veneer, rouge, aestheticism, art museums, new theaters, etc.
that make America impotent. The good things are football, kindness,
and jazz bands.
George Santayana

On Wed, Apr 6, 2011 at 6:33 PM, Michael Grant wrote:

 Given. I have a tendency to always use parseInt anyway, so I don't generally
 suffer that woe.
 However your point is well taken... a teeny bit of fuss, with a pinch of
 muss.

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343592
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: arrays and looping around

2010-09-29 Thread Rick Colman

  so, do I need to declare an array in advance, or is this implicit.

so, I guess this does not work either:

cfset LegalProteinSequence_#LoopCount# =  ...

On 9/27/2010 10:10 PM, Ian Skinner wrote:
 On 9/27/2010 7:37 PM, Michael Grant wrote:
 #form['ExpOrg_ID_'   loopCount]#

 A.K.A. Array Notation and can be applied to any variable scope, not
 just the form scope, though that is probably the most common.


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337609
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: arrays and looping around

2010-09-29 Thread Dave Watts

  so, do I need to declare an array in advance, or is this implicit.

Existing scopes (Form, Url, Variables, etc) can always be treated this way.

 so, I guess this does not work either:

 cfset LegalProteinSequence_#LoopCount# =  ...

I gave you several examples of this in another thread: looping syntax
inside a function?

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsit

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337615
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: arrays and looping around

2010-09-29 Thread Bobby Hartsfield

No you do not need to declare an array in this case. It is not actually an
array; it is just called array notation because it is the same syntax you
would use on an array. FORM is actually a predefined structure/collection
(aka 'scope')... such as URL or VARIABLES scopes

Most variables that you can reference as scope.variable, you can reference
as scope[variable]
 
In your last example: cfset LegalProteinSequence_#LoopCount# =  ...

You are right, that does not work. You can do one of the following instead:

cfset LegalProteinSequence_#LoopCount# =  ...

cfset variables[LegalProteinSequence_#LoopCount#] =  ...

cfset variables[LegalProteinSequence_  LoopCount] =  ...
 


.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
 
-Original Message-
From: Rick Colman [mailto:rcol...@cox.net] 
Sent: Tuesday, September 28, 2010 3:42 PM
To: cf-talk
Subject: Re: arrays and looping around


  so, do I need to declare an array in advance, or is this implicit.

so, I guess this does not work either:

cfset LegalProteinSequence_#LoopCount# =  ...

On 9/27/2010 10:10 PM, Ian Skinner wrote:
 On 9/27/2010 7:37 PM, Michael Grant wrote:
 #form['ExpOrg_ID_'   loopCount]#

 A.K.A. Array Notation and can be applied to any variable scope, not
 just the form scope, though that is probably the most common.


 



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337622
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: arrays and looping around

2010-09-29 Thread Michael Grant

Another way:

setVariable(LegalProteinSequence_  loopcount, this-is-a-value);


On Tue, Sep 28, 2010 at 3:42 PM, Rick Colman rcol...@cox.net wrote:


  so, do I need to declare an array in advance, or is this implicit.

 so, I guess this does not work either:

 cfset LegalProteinSequence_#LoopCount# =  ...

 On 9/27/2010 10:10 PM, Ian Skinner wrote:
  On 9/27/2010 7:37 PM, Michael Grant wrote:
  #form['ExpOrg_ID_'   loopCount]#
 
  A.K.A. Array Notation and can be applied to any variable scope, not
  just the form scope, though that is probably the most common.
 
 
 

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337628
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


arrays and looping around

2010-09-27 Thread Rick Colman

  I can't seem to get this working, and it should not be that tough?

Here what I am trying to do:

* get the number of form variables  coming in

* loop through the number of variables coming in, and as each form 
variable comes in, do a query

* store the results of the query in an another variable

I can't seem to figure out how to attach a subscript to a form 
variable name.

Here is what is the kind of thing that is NOT working:

cfloop index = LoopCount from=1 to=#form.num_vars# step=1

cfquery name=GetOrg_#LoopCount# ... 
 select * from table
 where ID = #form.ExpOrg_ID_#LoopCount##
/cfquery

i have tried several variations, and they generate interesting errors.

if someone would be so kind as to map this out for me, I can get over 
the hump.

TNX if you can help.

Rick.

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337592
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: arrays and looping around

2010-09-27 Thread Michael Grant

#form['ExpOrg_ID_'  loopCount]#



On Mon, Sep 27, 2010 at 10:29 PM, Rick Colman rcol...@cox.net wrote:


  I can't seem to get this working, and it should not be that tough?

 Here what I am trying to do:

 * get the number of form variables  coming in

 * loop through the number of variables coming in, and as each form
 variable comes in, do a query

 * store the results of the query in an another variable

 I can't seem to figure out how to attach a subscript to a form
 variable name.

 Here is what is the kind of thing that is NOT working:

 cfloop index = LoopCount from=1 to=#form.num_vars# step=1

 cfquery name=GetOrg_#LoopCount# ... 
 select * from table
 where ID = #form.ExpOrg_ID_#LoopCount##
 /cfquery

 i have tried several variations, and they generate interesting errors.

 if someone would be so kind as to map this out for me, I can get over
 the hump.

 TNX if you can help.

 Rick.

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337593
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: arrays and looping around

2010-09-27 Thread Ian Skinner

On 9/27/2010 7:37 PM, Michael Grant wrote:
 #form['ExpOrg_ID_'  loopCount]#


A.K.A. Array Notation and can be applied to any variable scope, not 
just the form scope, though that is probably the most common.


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337594
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Looping through arrays with structures

2010-09-21 Thread Richard Steele

Thanks all. That was very helpful. Here's the code I ended up using. 


cfloop from=1 to=#arrayLen(keyword_results)# index=x 
cfloop from=1 to=#arrayLen(keyword_results[x].images)# index=y 
cfoutput#keyword_results[x].images[y]#/cfoutput 
/cfloop 
/cfloop 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337280
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Looping through arrays with structures

2010-09-21 Thread Michael Grant

I thought images was a structure containing an array?


On Tue, Sep 21, 2010 at 5:15 PM, Richard Steele r...@photoeye.com wrote:


 Thanks all. That was very helpful. Here's the code I ended up using.


 cfloop from=1 to=#arrayLen(keyword_results)# index=x
cfloop from=1 to=#arrayLen(keyword_results[x].images)# index=y
cfoutput#keyword_results[x].images[y]#/cfoutput
/cfloop
 /cfloop

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337289
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Looping through arrays with structures

2010-09-18 Thread Michael Grant

No worries. An honest mistake.

I've actually never used the Array attribute since I've been looping this
way for 10 years. And unless it's inherently faster (which I doubt) I
suspect I never will. I actually prefer my loops to use an int as the index.
That was I've always got an easily available currentrow-like variable.



On Fri, Sep 17, 2010 at 11:25 PM, Andrew Scott andr...@andyscott.id.auwrote:


 Hehe, I doubt you are blind at all. I swear I actually read it as using the
 Array attribute, oh well let me get my eyes checked.

 Regards,
 Andrew Scott
 http://www.andyscott.id.au/


  -Original Message-
  From: Jacob Munson [mailto:yacoub...@gmail.com]
  Sent: Saturday, 18 September 2010 12:54 PM
  To: cf-talk
  Subject: Re: Looping through arrays with structures
 
 
  Am I blind?  The email I read from Michael does NOT show the array
  attribute.  In fact, his loop looks exactly like your code.


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337208
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Looping through arrays with structures

2010-09-17 Thread Richard Steele

I have an array with a structure that has an array. How do I loop through this 
in CF8 and retrieve the second array's 5 digit numbers? Thanks in advance. 

array
1 |
  | struct
  | IMAGES  |
  | | array
  | | 1  | 18990 
  | | 2  | 8
  | | 3  | 39209
  |
  | ID  | 13763



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337198
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Looping through arrays with structures

2010-09-17 Thread Michael Grant

cfloop from=1 to=#arrayLen(firstArray)# index=x

cfloop from=1 to=#arrayLen(firstArray[x].images.secondArray)#
index=y

cfoutput#firstArray[x].images.secondArray[y]#/cfoutput

/cfloop

/cfloop




On Fri, Sep 17, 2010 at 8:18 PM, Richard Steele r...@photoeye.com wrote:


 I have an array with a structure that has an array. How do I loop through
 this in CF8 and retrieve the second array's 5 digit numbers? Thanks in
 advance.

 array
 1 |
  | struct
  | IMAGES  |
  | | array
  | | 1  | 18990
  | | 2  | 8
  | | 3  | 39209
  |
  | ID  | 13763



 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337199
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Looping through arrays with structures

2010-09-17 Thread Andrew Scott

That won't work in certain versions of ColdFusion, if you are not using the
version of ColdFusion that supports this. You can do a normal cfloop from
and to and use the indexing of the array in this manner

cfloop from=1 to=#ArratLen(myArray)# index=arrayCounter
   myArray[arrayCounter].images
/cfloop


Regards,
Andrew Scott
http://www.andyscott.id.au/



 -Original Message-
 From: Michael Grant [mailto:mgr...@modus.bz]
 Sent: Saturday, 18 September 2010 10:35 AM
 To: cf-talk
 Subject: Re: Looping through arrays with structures
 
 
 cfloop from=1 to=#arrayLen(firstArray)# index=x
 
 cfloop from=1 to=#arrayLen(firstArray[x].images.secondArray)#
 index=y
 
 cfoutput#firstArray[x].images.secondArray[y]#/cfoutput
 
 /cfloop
 
 /cfloop
 


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337200
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Looping through arrays with structures

2010-09-17 Thread Michael Grant

What version of cf won't my code work in?

On Fri, Sep 17, 2010 at 8:42 PM, Andrew Scott andr...@andyscott.id.auwrote:


 That won't work in certain versions of ColdFusion, if you are not using the
 version of ColdFusion that supports this. You can do a normal cfloop from
 and to and use the indexing of the array in this manner

 cfloop from=1 to=#ArratLen(myArray)# index=arrayCounter
   myArray[arrayCounter].images
 /cfloop


 Regards,
 Andrew Scott
 http://www.andyscott.id.au/



  -Original Message-
  From: Michael Grant [mailto:mgr...@modus.bz]
  Sent: Saturday, 18 September 2010 10:35 AM
  To: cf-talk
  Subject: Re: Looping through arrays with structures
 
 
  cfloop from=1 to=#arrayLen(firstArray)# index=x
 
  cfloop from=1 to=#arrayLen(firstArray[x].images.secondArray)#
  index=y
 
  cfoutput#firstArray[x].images.secondArray[y]#/cfoutput
 
  /cfloop
 
  /cfloop
 


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337201
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Looping through arrays with structures

2010-09-17 Thread Andrew Scott

You can't be serious asking that sort of question, the array Attribute was
introduced in ColdFusion 8. So that means people who are still running
ColdFusion 5 - 7 will not be able to use that code.

Regards,
Andrew Scott
http://www.andyscott.id.au/


 -Original Message-
 From: Michael Grant [mailto:mgr...@modus.bz]
 Sent: Saturday, 18 September 2010 11:09 AM
 To: cf-talk
 Subject: Re: Looping through arrays with structures
 
 
 What version of cf won't my code work in?
 


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337203
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Looping through arrays with structures

2010-09-17 Thread Jacob Munson

Am I blind?  The email I read from Michael does NOT show the array
attribute.  In fact, his loop looks exactly like your code.

On Fri, Sep 17, 2010 at 6:42 PM, Andrew Scott andr...@andyscott.id.auwrote:


 That won't work in certain versions of ColdFusion, if you are not using the
 version of ColdFusion that supports this. You can do a normal cfloop from
 and to and use the indexing of the array in this manner

 cfloop from=1 to=#ArratLen(myArray)# index=arrayCounter
   myArray[arrayCounter].images
 /cfloop


 Regards,
 Andrew Scott
 http://www.andyscott.id.au/



  -Original Message-
  From: Michael Grant [mailto:mgr...@modus.bz]
  Sent: Saturday, 18 September 2010 10:35 AM
  To: cf-talk
  Subject: Re: Looping through arrays with structures
 
 
  cfloop from=1 to=#arrayLen(firstArray)# index=x
 
  cfloop from=1 to=#arrayLen(firstArray[x].images.secondArray)#
  index=y
 
  cfoutput#firstArray[x].images.secondArray[y]#/cfoutput
 
  /cfloop
 
  /cfloop
 


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337204
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Looping through arrays with structures

2010-09-17 Thread Charlie Griefer

He didn't use the array attribute.  He used the exact same index loop that
you did (from=1 to=#arrayLen(myArray)#).

On Fri, Sep 17, 2010 at 6:56 PM, Andrew Scott andr...@andyscott.id.auwrote:


 You can't be serious asking that sort of question, the array Attribute was
 introduced in ColdFusion 8. So that means people who are still running
 ColdFusion 5 - 7 will not be able to use that code.

 Regards,
 Andrew Scott
 http://www.andyscott.id.au/


  -Original Message-
  From: Michael Grant [mailto:mgr...@modus.bz]
  Sent: Saturday, 18 September 2010 11:09 AM
  To: cf-talk
  Subject: Re: Looping through arrays with structures
 
 
  What version of cf won't my code work in?
 


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337205
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Looping through arrays with structures

2010-09-17 Thread Andrew Scott

Hehe, I doubt you are blind at all. I swear I actually read it as using the
Array attribute, oh well let me get my eyes checked.

Regards,
Andrew Scott
http://www.andyscott.id.au/


 -Original Message-
 From: Jacob Munson [mailto:yacoub...@gmail.com]
 Sent: Saturday, 18 September 2010 12:54 PM
 To: cf-talk
 Subject: Re: Looping through arrays with structures
 
 
 Am I blind?  The email I read from Michael does NOT show the array
 attribute.  In fact, his loop looks exactly like your code.


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337206
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Checking arrays for any values

2010-09-06 Thread Peter Boughton

It's not clear what you're trying to do.

Can you post examples of each type of value it might contain, and whether that 
is considered true/false?

(It's probably still simplest to step through the array and check each value 
though.) 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336832
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Checking arrays for any values

2010-09-06 Thread Scott Brady

You can do listFind(arrayToList(aYourArray),1)  for the bit datatypes.  I'm
not sure what the performance of that will be if your array is very large,
though.

For the string array, you can do NOT listFind(arrayToList(aYourArray,))

I'm not sure if that logic is exactly correct, but it should get you going
down the right path.

Scott

On Sun, Sep 5, 2010 at 6:46 PM, Richard Steele r...@photoeye.com wrote:


 If any of the elements of an array have a value of 1 for bit datatypes or
 don't have empty strings for string datatypes, then I need to have my
 program do one thing, otherwise, if everything is either empty or false,
 another thing.  I could parse the array and get their values, but I wonder
 if there is an easier way.



-- 
-
Scott Brady
http://www.scottbrady.net/


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336833
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Checking arrays for any values

2010-09-06 Thread Peter Boughton

In CF9, Adobe have (finally) added the ArrayFind function, which simplifies 
that code.

(Also available in OpenBD v1.3 and above, and in Railo since early days.) 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336835
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Checking arrays for any values

2010-09-05 Thread Richard Steele

If any of the elements of an array have a value of 1 for bit datatypes or don't 
have empty strings for string datatypes, then I need to have my program do one 
thing, otherwise, if everything is either empty or false, another thing.  I 
could parse the array and get their values, but I wonder if there is an easier 
way. 

Thanks in advance. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336830
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Checking arrays for any values

2010-09-05 Thread Richard Steele

If any of the elements of an array have a value of 1 for bit datatypes or if 
all string datatypes are empty, then I need to have my program do one thing, 
otherwise, if everything is either empty or false, another thing.  I could 
parse the array and get their values, but I wonder if there is an easier way. 

Thanks in advance. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336831
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Arrays - humbug! - Part 1

2010-02-05 Thread Stephens, Larry V

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
steph...@indiana.edu

~|
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:330418
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Arrays - humbug! - Part 2

2010-02-05 Thread Stephens, Larry V

Array problems #2

Since I have nothing to load into the array, yet, my last functional directive 
was

cfset SESSION.Report.Lats = ArrayNew(2)


The next piece of related offending code is

cfif ArrayLen(SESSION.Report.Lats) GT 0
 Lateral reporting structure:
 ul
  cfloop collection=SESSION.Report.Lats index=i
   li
a href=mailto:#SESSION.Report.Lats[i,8]#;#SESSION.Report.Lats[i,4]#/a 
(#SESSION.Report.Lats[i,5]#) Sent: #SESSION.Report.Lats[i,9]#br
TX: #SESSION.Report.Lats[i,6]# FAX: #SESSION.Report.Lats[i,7]# Email: 
#SESSION.Report.Lats[i,8]#br
blockquote#SESSION.Report.Lats[i,3]#/blockquote
   /li
  /cfloop
 /ul
/cfif

I get another invalid construct error for something at 
#SESSION.Report.Lats[i,5]#. No apparent complaints about the first two array 
elements.

Again, this code isn't executing because I have no data to load into it yet.

What am I missing? Thanks.

Larry Stephens
steph...@indiana.edu


~|
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:330419
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Arrays - humbug! - Part 2

2010-02-05 Thread Tom McNeer

Larry,

Not sure exactly what you're going for. But rather than go into array usage
(and looping a collection), which you can probably learn better elsewhere,
maybe there's a simpler way to attack the problem.

In the end, you seem to simply want to go over a query result:

  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

... and output it onto the page. Now, I'm assuming that you're stuffing the
results into the session scope because you need to use it more than one
place. But I can't see why you need to create the array or do all that
looping.

Can't you simply place the query result into the session scope:

cfset session.Report.Lats = getLats /

... then output it on the page:

cfif session.Report.Lats.recordCount GT 0
cfoutput query=session.Report.Lats

... and built your list item here.

   /cfoutput
/cfif

Or have I missed what you're going for?



-- 
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560


~|
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:330421
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Arrays - humbug! - Part 1

2010-02-05 Thread I. Addoum.

@larry


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

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


regards
Bob




From: Stephens, Larry V steph...@indiana.edu
To: cf-talk cf-talk@houseoffusion.com
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
steph...@indiana.edu



~|
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:330422
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


AW: SPAM-LOW: Arrays - humbug! - Part 1

2010-02-05 Thread Gert Franz

Yes, you're missing something, what you need to do is:
cfset SESSION.Report.Lats[a][1] = latID  

Greetings from Switzerland
Gert Franz

Railo Technologies   Professional Open Source
skype: gert.franz    g...@getrailo.com
+41 76 5680 231  www.getrailo.com


-Ursprüngliche Nachricht-
Von: Stephens, Larry V [mailto:steph...@indiana.edu] 
Gesendet: Freitag, 5. Februar 2010 15:07
An: cf-talk
Betreff: SPAM-LOW: 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) 

~|
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:330425
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


AW: SPAM-LOW: Arrays - humbug! - Part 2

2010-02-05 Thread Gert Franz

Same error here. You need to address an array like this:

array[firstdimension][seconddimension]

Greetings from Switzerland
Gert Franz

Railo Technologies   Professional Open Source
skype: gert.franz    g...@getrailo.com
+41 76 5680 231  www.getrailo.com


-Ursprüngliche Nachricht-
Von: Stephens, Larry V [mailto:steph...@indiana.edu] 
Gesendet: Freitag, 5. Februar 2010 15:10
An: cf-talk
Betreff: SPAM-LOW: Arrays - humbug! - Part 2


Array problems #2

Since I have nothing to load into the array, yet, my last functional
directive was

cfset SESSION.Report.Lats = ArrayNew(2)


The next piece of related offending code is

cfif ArrayLen(SESSION.Report.Lats) GT 0
 Lateral reporting structure:
 ul
  cfloop collection=SESSION.Report.Lats index=i
   li
a
href=mailto:#SESSION.Report.Lats[i,8]#;#SESSION.Report.Lats[i,4]#/a
(#SESSION.Report.Lats[i,5]#) Sent: #SESSION.Report.Lats[i,9]#br
TX: #SESSION.Report.Lats[i,6]# FAX: #SESSION.Report.Lats[i,7]# Email:
#SESSION.Report.Lats[i,8]#br
blockquote#SESSION.Report.Lats[i,3]#/blockquote
   /li
  /cfloop
 /ul
/cfif

I get another invalid construct error for something at
#SESSION.Report.Lats[i,5]#. No apparent complaints about the first two array
elements.

Again, this code isn't executing because I have no data to load into it yet.

What am I missing? Thanks.

Larry Stephens
steph...@indiana.edu




~|
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:330426
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Arrays - humbug! - Part 1

2010-02-05 Thread Stephens, Larry V

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:sol_xp...@yahoo.com] 
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 steph...@indiana.edu
To: cf-talk cf-talk@houseoffusion.com
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
steph...@indiana.edu





~|
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


RE: Arrays - humbug! - Part 2

2010-02-05 Thread Stephens, Larry V

Another good idea that I'll keep in my back pocket. I manipulate the array in 
later code in ways I couldn't do with this method, but still a useful thing to 
remember. Thanks. 


 

-Original Message-
From: Tom McNeer [mailto:tmcn...@gmail.com] 
Sent: Friday, February 05, 2010 9:43 AM
To: cf-talk
Subject: Re: Arrays - humbug! - Part 2


Larry,

Not sure exactly what you're going for. But rather than go into array usage 
(and looping a collection), which you can probably learn better elsewhere, 
maybe there's a simpler way to attack the problem.

In the end, you seem to simply want to go over a query result:

  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

... and output it onto the page. Now, I'm assuming that you're stuffing the 
results into the session scope because you need to use it more than one place. 
But I can't see why you need to create the array or do all that looping.

Can't you simply place the query result into the session scope:

cfset session.Report.Lats = getLats /

... then output it on the page:

cfif session.Report.Lats.recordCount GT 0
cfoutput query=session.Report.Lats

... and built your list item here.

   /cfoutput
/cfif

Or have I missed what you're going for?

~|
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:330441
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Arrays - humbug! - Part 2

2010-02-05 Thread Tom McNeer

For further manipulation, it's also sometimes handy to remember that a query
object is essentially a struct of arrays, with the selected columns at
struct keys.

So you can also do things like:

cfif Session.Report.lats.recordCount GT 0
  cfloop from=1 to #Session.Report.lats.recordCount# index=i
 do something with Session.Report.lats.Why[i]

  /cfloop
/cfif

Of course, you can always just cfloop query=Session.Report.lats and
avoid the use of the index. Just thought I'd point out that you can access
individual records in the array for each column with array notation.

-- 
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560


~|
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:330445
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


compare arrays for same

2009-10-15 Thread Richard White

hi

is there a function to compare 2 arrays or lists and return the values that 
exist in both?

i have found plenty they return then difference but not for this case

thanks


~|
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:327225
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: compare arrays for same

2009-10-15 Thread John M Bliss

http://cflib.org/udf/listVenn

On Thu, Oct 15, 2009 at 6:05 AM, Richard White rich...@j7is.co.uk wrote:


 hi

 is there a function to compare 2 arrays or lists and return the values that
 exist in both?

 i have found plenty they return then difference but not for this case

 thanks


 

~|
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:327227
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: compare arrays for same

2009-10-15 Thread Leigh

 is there a function to compare 2 arrays or lists and return
 the values that exist in both?

Not that I know of, but you could create your own.  Though I have not looked, 
but I would be very surprised if cflib.org did not already have a function for 
this

This could certainly be improved ...
cfset list1 = a,b,c,d,e,f,g,h,i
cfset list2 = 1,b,2,3,e,6,9
cfset shared = 
cfloop list=#list1# index=elem
cfif listFindNoCase(list2, elem)
cfset shared = listAppend(shared, elem)
/cfif
/cfloop
cfoutput
shared = #shared#br
/cfoutput


  


~|
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:327229
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: compare arrays for same

2009-10-15 Thread Richard White

neat function!

thanks to all posts



http://cflib.org/udf/listVenn

On Thu, Oct 15, 2009 at 6:05 AM, Richard White rich...@j7is.co.uk wrote:

 

~|
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:327232
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: compare arrays for same

2009-10-15 Thread Leigh

 http://cflib.org/udf/listVenn

Hah! I knew cflib.org must have a function for that ... ;-)


  


~|
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:327233
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Sorting 2d arrays

2009-10-15 Thread Tony Bentley

I have an app currently that needs a list sorted alphabetically with 
alpha-numeric chars. I am using a query and then narrowing the results into an 
array and then creating two lists for an autosuggest. Imagine searching by an 
alphanumeric ID (not SQL ID) and also by the description:

1234ii -- apple
1234i -- banana
123x -- orange
orange -- 123x
banana -- 1234i
apple -- 1234ii

Then once the sorting is completed, I need to grab the unique ID (incremental 
SQL ID) from the original array again and then use that to update the database. 

Currently I am building the array, sorting with quickSort2D(), building the 
list and then to grab the SQL ID from the array again I use a function that 
loops through the array to match ID  ' -- '  text or vice versa. This takes 
about 20 seconds to build. Also, this is something that will change per page 
refresh so storing anything in memory is pretty much nil.

Any thoughts on simplifying the process? Anyone have experience with speeding 
up array processes? 

~|
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:327249
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Sorting 2d arrays

2009-10-15 Thread Dave Phillips

Tony,

Probably a ton of ways to do this.  Would this get you what you want?:

(note:  the below would be for oracle, you need + instead of || for Sql
server - not sure about what db you're using)

cfquery datasource=whatever name=qMySuggestions
select sql_id,
alphanumeric_id || description as auto_suggest_descr
from mytable
union
select sql_id,
description || alphanumeric_id as auto_suggest_descr
from mytable
order by augo_suggest_descr
/cfquery

Now you should have a query with the results in the order you want them with
the original sql_id also there.  Now instead of looping through an array to
do a match, you simply do a query of query:

cfquery name=qFindMatch dbtype=query
SELECT sql_id FROM qMySuggestions
WHERE (put your condition here to find a match)
/cfquery

qFindMatch.sql_id is the record you want.

Dave Phillips


~|
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:327252
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Sorting 2d arrays

2009-10-15 Thread Tony Bentley

Okay I figured it was going to be a query based solution. Turns out there is a 
table in SQL Server that lists all chars in ASCII so I can sort based on that 
table's numeric values and then return two columns to output. Pretty RAD.

here's the t-sql to generate it.
---
set nocount on
declare @integers table ([Number] INT)
declare @i int
declare @char varchar(255)
set @i = 1
while @i  128
begin
insert into @integers values (@i)
set @i = @i + 1
end

declare char_test cursor for
select [Number] from @integers
open char_test
fetch next from char_test into @char

while @@fetch_status = 0
begin
print 'char #' + @char + ' = ' + char(@char)
fetch next from char_test into @char
end
close char_test
deallocate char_test



~|
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:327263
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Sorting 2d arrays

2009-10-15 Thread Tony Bentley

Sorry, forgot to mention that the query above just returns the ASCII chars. 
Then I use a different query to classify the first char:
DECLARE @ErrorNum   INT
SET @ErrorNum = 1

DECLARE @ TABLE (
[Id]INT,
[Name]  VARCHAR(255),
[Number]VARCHAR(255),
[_] VARCHAR(255),
[_] VARCHAR(255),
[SortOrder] TINYINT)
ERT INTO@
SELECT  a.[Id],
a.[Name],
CASE WHEN ISNULL(a.[Number], '') = '' THEN '' ELSE a.[Number] END,
CASE WHEN ISNULL(a.[Number], '') = '' THEN a.[Name] ELSE a.[Name] + ' -- ' + 
a.[Number] END,
CASE WHEN ISNULL(a.[Number], '') = '' THEN '' ELSE a.[Number] + ' -- ' + 
a.[Name] END,
CASE 
WHEN ASCII(LEFT(a.[Name], 1)) BETWEEN 0 AND 47 THEN 1 -- symbols ordered first
WHEN ASCII(LEFT(a.[Name], 1)) BETWEEN 48 AND 57 THEN 2 -- numbers ordered second
WHEN ASCII(LEFT(a.[Name], 1)) BETWEEN 58 AND 64 THEN 1 -- symbols ordered first
WHEN ASCII(LEFT(a.[Name], 1)) BETWEEN 65 AND 90 THEN 3 -- letters ordered third
WHEN ASCII(LEFT(a.[Name], 1)) BETWEEN 91 AND 96 THEN 1 -- symbols ordered first
WHEN ASCII(LEFT(a.[Name], 1)) BETWEEN 97 AND 122 THEN 3 -- letters ordered third
ELSE 1 END
FROM[dbo].[] AS a
WHERE   a.[Name]  'All s'

There is more but you get the idea.

Talk about rabbit and tortoise! 

~|
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:327264
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Outputting implicit arrays?

2009-08-20 Thread Tony Bentley

I thought this would be something fun to discuss. How do you output implicit 
arrays?

here is the array (we will use a navigation as an example):



navigation = [
{name=home,href=index.cfm,class=nav},
{name=contact,href=contact.cfm,class=nav}
]; 

~|
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:325576
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Outputting implicit arrays?

2009-08-20 Thread Barney Boisvert

The same was as non-literal arrays?  CFLOOP, CFDUMP, serializeJson,
there are lots of ways.  I'm not sure what you want to discuss?

On Thu, Aug 20, 2009 at 1:30 PM, Tony Bentleyt...@tonybentley.com wrote:

 I thought this would be something fun to discuss. How do you output implicit 
 arrays?

 here is the array (we will use a navigation as an example):



 navigation = [
 {name=home,href=index.cfm,class=nav},
 {name=contact,href=contact.cfm,class=nav}
 ];

 

~|
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:325577
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Outputting implicit arrays?

2009-08-20 Thread Rick Root

On Thu, Aug 20, 2009 at 4:30 PM, Tony Bentleyt...@tonybentley.com wrote:

 I thought this would be something fun to discuss. How do you output implicit 
 arrays?

Once you create the array, there is no difference between an
implicitly created array and an array created via ArrayNew()

So...  you output it just like any other array.

-- 
Rick Root
New Brian Vander Ark Album, songs in the music player and cool behind
the scenes video at www.myspace.com/brianvanderark

~|
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:325578
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Append Arrays with Structures

2009-03-11 Thread Priya Koya

I am trying to add my Pagelist to the array .. using structure. I am using 
structure to add everytime pagelist to an array so that I can display my list 
of pages updated or inserted on every user session. This is wat I am using...

cfparam name=session.pageList default=arrayNew()
!--- Append a new element to the array.  This element is a new structure. ---
cfset session.pageList = arrayAppend( session.pageList, structNew() )
!--- Set up a variable to hold the array position that we're inserting into. 
---
cfset NumberPage = arraylen(session.PageList)
!--- Populate the new structure with the item information passed from the 
form. ---
cfset session.cart[NumberPage].PageListInfo = session.page

cfloop index=NumberPage from=1 to=#arraylen(sesson.item)#
cfset session.item[NumberPage].PageListInfo = session.page
/cfloop

I get an error:
Object of type class java.lang.String cannot be used as an array 

Can anyone Help with this  

Thanks,
Priya


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320351
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Append Arrays with Structures

2009-03-11 Thread Dominic Watson

ArrayAppend does not return the array - it returns True, on
successful completion.

(http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentationfile=0381.htm)

So:

cfparam name=session.pageList default=#arrayNew(1)# /
cfset arrayAppend( session.pageList, structNew() ) /
... etc.


Dominic

 !--- Set up a variable to hold the array position that we're inserting into. 
 ---
 cfset NumberPage = arraylen(session.PageList)
 !--- Populate the new structure with the item information passed from the 
 form. ---
 cfset session.cart[NumberPage].PageListInfo = session.page

 cfloop index=NumberPage from=1 to=#arraylen(sesson.item)#
 cfset session.item[NumberPage].PageListInfo = session.page
 /cfloop

2009/3/11 Priya Koya priya23...@gmail.com:

 I am trying to add my Pagelist to the array .. using structure. I am using 
 structure to add everytime pagelist to an array so that I can display my list 
 of pages updated or inserted on every user session. This is wat I am using...

 cfparam name=session.pageList default=arrayNew()
 !--- Append a new element to the array.  This element is a new structure. 
 ---
 cfset session.pageList = arrayAppend( session.pageList, structNew() )
 !--- Set up a variable to hold the array position that we're inserting into. 
 ---
 cfset NumberPage = arraylen(session.PageList)
 !--- Populate the new structure with the item information passed from the 
 form. ---
 cfset session.cart[NumberPage].PageListInfo = session.page

 cfloop index=NumberPage from=1 to=#arraylen(sesson.item)#
 cfset session.item[NumberPage].PageListInfo = session.page
 /cfloop

 I get an error:
 Object of type class java.lang.String cannot be used as an array 

 Can anyone Help with this 

 Thanks,
 Priya


 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320352
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Append Arrays with Structures

2009-03-11 Thread Jason Fisher

You're setting the value of session.pageList to the string arrayNew(), which 
is throwing your error.  If you're using cfparam then you need the # signs and 
to create an array you need to specify the number of dimensions (in this case 
1):

cfparam name=session.pageList default=#arrayNew(1)# /

If this is not in a loop or something, you could just set directly:

cfset session.pageList = arrayNew(1) / 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320357
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Append Arrays with Structures

2009-03-11 Thread Ian Skinner

Jason Fisher wrote:
 If you're using cfparam then you need the # signs 
   

Or get rid of the quotes.

 cfparam name=session.pageList default=#arrayNew(1)# /

I.E. This also works.

cfparam name=session.pageList default = arrayNew(1) / !--- note the 
lack of quotes in the default parameter ---

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320358
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Append Arrays with Structures

2009-03-11 Thread Priya Koya

I am getting an error here:
*session.pageList = arrayAppend( session.pageList, structNew() ) *

Error:
 Object of type class java.lang.Boolean cannot be used as an array
On Wed, Mar 11, 2009 at 9:55 AM, Jason Fisher ja...@wanax.com wrote:


 You're setting the value of session.pageList to the string arrayNew(),
 which is throwing your error.  If you're using cfparam then you need the #
 signs and to create an array you need to specify the number of dimensions
 (in this case 1):

 cfparam name=session.pageList default=#arrayNew(1)# /

 If this is not in a loop or something, you could just set directly:

 cfset session.pageList = arrayNew(1) /

 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320359
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Append Arrays with Structures

2009-03-11 Thread Jason Fisher

As Dominic pointed out above, just do:

cfset arrayAppend( session.pageList, structNew() ) /

ArrayAppend() returns true / false, not an array. 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320360
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Append Arrays with Structures

2009-03-11 Thread Azadi Saryev

yes, as jason pinted out, arrayappend() function differs from
listappend() - with arrayappend() one should not set the array to the
function's return:

with arrayappend:
cfset arrayappend(arrayvar, value_to_append)

but with listappend() one has to do:
cfset prev_defined_list_var = listappend(prev_defined_list_var,
new_value_to_append)

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/



Priya Koya wrote:
 I am getting an error here:
 *session.pageList = arrayAppend( session.pageList, structNew() ) *

 Error:
  Object of type class java.lang.Boolean cannot be used as an array
 On Wed, Mar 11, 2009 at 9:55 AM, Jason Fisher ja...@wanax.com wrote:

   
 You're setting the value of session.pageList to the string arrayNew(),
 which is throwing your error.  If you're using cfparam then you need the #
 signs and to create an array you need to specify the number of dimensions
 (in this case 1):

 cfparam name=session.pageList default=#arrayNew(1)# /

 If this is not in a loop or something, you could just set directly:

 cfset session.pageList = arrayNew(1) /


 

 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320362
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Append Arrays with Structures

2009-03-11 Thread Ian Skinner

Priya Koya wrote:
 I am getting an error here:
 *session.pageList = arrayAppend( session.pageList, structNew() ) *

 Error:
  Object of type class java.lang.Boolean cannot be used as an array
 On Wed, Mar 11, 2009 at 9:55 AM, Jason Fisher ja...@wanax.com wrote:
As Dominic previously stated, arrayAppend() returns a boolean value.  
The first time you run that line you are overwriting your array and 
turning it into an array, then the next loop iteration throws an error 
because session.pageList is now a boolean.

Drop the left side of the line.

cfset arrayAppend(session.pageList ,structNew())



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320363
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Append Arrays with Structures

2009-03-11 Thread Priya Koya

Jason,


cfparam name=session.pageList default= arrayNew(1)

cfparam name=session.pageList default=#arrayNew(1)#

cfparam name=session.pageList default=#arrayNew(1)#

cfparam name=session.pageList default=arrayNew(1)

cfparam name=session.pageList default=#arrayNew(1)#

nothing works



I tried with :


On Wed, Mar 11, 2009 at 9:16 AM, Ian Skinner h...@ilsweb.com wrote:


 Jason Fisher wrote:
  If you're using cfparam then you need the # signs
 

 Or get rid of the quotes.

  cfparam name=session.pageList default=#arrayNew(1)# /

 I.E. This also works.

 cfparam name=session.pageList default = arrayNew(1) / !--- note the
 lack of quotes in the default parameter ---

 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320365
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Append Arrays with Structures

2009-03-11 Thread Ian Skinner

Ian Skinner wrote:
 The first time you run that line you are overwriting your array and 
 turning it into an array...

The first time you run that line you are overwriting your array and 
turning it into an *boolean* ...

That would make more sense, wouldn't it.



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320367
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Append Arrays with Structures

2009-03-11 Thread Ian Skinner

Priya Koya wrote:
 nothing works
   

That is because the cfparam... tag is not your problem.

Your problem is that in the loop, the first iteration changes your array 
into a boolean.  Then the second iteration throws an error because you 
try to use that boolean variable as an array.

See the five posts to this effect.




~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320368
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Append Arrays with Structures

2009-03-11 Thread Adrian Lynch

Out of interest, I wonder what would have to happen for ArrayAppend to
return false?!

Adrian

 -Original Message-
 From: Dominic Watson [mailto:watson.domi...@googlemail.com]
 Sent: 11 March 2009 12:37
 To: cf-talk
 Subject: Re: Append Arrays with Structures
 
 
 ArrayAppend does not return the array - it returns True, on
 successful completion.
 
 (http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/
 html/wwhelp.htm?context=ColdFusion_Documentationfile=0381.htm)
 
 So:
 
 cfparam name=session.pageList default=#arrayNew(1)# /
 cfset arrayAppend( session.pageList, structNew() ) /
 ... etc.
 
 
 Dominic


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320373
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Append Arrays with Structures

2009-03-11 Thread Priya Koya

Is this right?

cfset myarray = arrayNew(1)

cfset session.pageList = arrayAppend( myarray, structNew() )

cfset NumberPage = arraylen(session.PageList)
for finding out he arraylen??
because this is where it is giving me the error..

On Wed, Mar 11, 2009 at 10:21 AM, Adrian Lynch cont...@adrianlynch.co.ukwrote:


 Out of interest, I wonder what would have to happen for ArrayAppend to
 return false?!

 Adrian

  -Original Message-
  From: Dominic Watson [mailto:watson.domi...@googlemail.com]
  Sent: 11 March 2009 12:37
  To: cf-talk
  Subject: Re: Append Arrays with Structures
 
 
  ArrayAppend does not return the array - it returns True, on
  successful completion.
 
  (http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/
  html/wwhelp.htm?context=ColdFusion_Documentationfile=0381.htm)
 
  So:
 
  cfparam name=session.pageList default=#arrayNew(1)# /
  cfset arrayAppend( session.pageList, structNew() ) /
  ... etc.
 
 
  Dominic


 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320375
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Append Arrays with Structures

2009-03-11 Thread Charlie Griefer

it's been said over and over in this thread.  arrayAppend() returns a
boolean.
if you do cfset session.pageList = arrayAppend(myArray, structNew()) /,
you're essentially setting the value of session.pageList to true.

Then, when you try to run an array function on session.pageList, you get the
error because it's not an array.  it's a boolean whose value is true.

read thru the replies and you'll see.  you're asking for help and people are
trying to give it to you, but you don't seem to want to take it.

cfset arrayAppend(myArray, structNew()) /.  that will fix your problems.

On Wed, Mar 11, 2009 at 8:48 AM, Priya Koya priya23...@gmail.com wrote:


 Is this right?

 cfset myarray = arrayNew(1)

 cfset session.pageList = arrayAppend( myarray, structNew() )

 cfset NumberPage = arraylen(session.PageList)
 for finding out he arraylen??
 because this is where it is giving me the error..

 On Wed, Mar 11, 2009 at 10:21 AM, Adrian Lynch cont...@adrianlynch.co.uk
 wrote:

 
  Out of interest, I wonder what would have to happen for ArrayAppend to
  return false?!
 
  Adrian
 
   -Original Message-
   From: Dominic Watson [mailto:watson.domi...@googlemail.com]
   Sent: 11 March 2009 12:37
   To: cf-talk
   Subject: Re: Append Arrays with Structures
  
  
   ArrayAppend does not return the array - it returns True, on
   successful completion.
  
   (
 http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/
   html/wwhelp.htm?context=ColdFusion_Documentationfile=0381.htm)
  
   So:
  
   cfparam name=session.pageList default=#arrayNew(1)# /
   cfset arrayAppend( session.pageList, structNew() ) /
   ... etc.
  
  
   Dominic
 
 
 

 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320376
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Append Arrays with Structures

2009-03-11 Thread Ian Skinner

Priya Koya wrote:
 Is this right?

 cfset myarray = arrayNew(1)

 cfset session.pageList = arrayAppend( myarray, structNew() )

 cfset NumberPage = arraylen(session.PageList)
 for finding out he arraylen??
 because this is where it is giving me the error..

Yes, it was, Charlie just explained this again for you.

cfset arrayAppend(session.pageList, structNew() would solve the 
problems you have told us about.

But just for another tact, I will also correct this latest code example.

cfset myArray = arrayNew(1)

cfset session.pageList = arrayAppend ( myArray, structNew() )
!--- this is an acceptable line, but session.pageList is basically a 
meaningless variable and almost nobody bothers with it ---

cfset NumberPage = arrayLen(myArray)
!--- see how the arrayAppend() function modified the array used in the 
parameter ---



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320378
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Append Arrays with Structures

2009-03-11 Thread Jason Fisher

@Adrian,

Interesting question ... can't really think of anything off-hand.


From: Adrian Lynch cont...@adrianlynch.co.uk
Sent: Wednesday, March 11, 2009 11:25 AM
To: cf-talk cf-talk@houseoffusion.com
Subject: RE: Append Arrays with Structures 

Out of interest, I wonder what would have to happen for ArrayAppend to
return false?!

Adrian

 


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320382
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Append Arrays with Structures

2009-03-11 Thread Dominic Watson

I don't believe that it ever does return false and the docs do not
indicate that it does. Indeed, it is almost certainly using the add
method of the java AbstractList object (from which it inherits). This
states that it returns true only. If there is an error, an exception
is thrown.

http://java.sun.com/j2se/1.4.2/docs/api/java/util/AbstractList.html#add(java.lang.Object)

Dominic

2009/3/11 Jason Fisher ja...@wanax.com:

 @Adrian,

 Interesting question ... can't really think of anything off-hand.

 
 From: Adrian Lynch cont...@adrianlynch.co.uk
 Sent: Wednesday, March 11, 2009 11:25 AM
 To: cf-talk cf-talk@houseoffusion.com
 Subject: RE: Append Arrays with Structures

 Out of interest, I wonder what would have to happen for ArrayAppend to
 return false?!

 Adrian




 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320383
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Append Arrays with Structures

2009-03-11 Thread Jason Fisher

Thanks for the info, Dominic.  Seems like that shouldn't make sense ... a 
Boolean that has no 'off' state, yet it perfectly makes sense that only an 
exception could be 'false' and exceptions need to be thrown, not simply 
reported as 'false'.

Thanks!
Jason


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320384
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Append Arrays with Structures

2009-03-11 Thread Dominic Watson

 Seems like that shouldn't make sense ... a Boolean that has no 'off' state

Nowhere states that the function returns a boolean ;) But it is odd,
indeed, why return anything at all. I've done it myself in functions
and justified it with 'One day I may have some logic that returns
false and then the calling code that is checking for the boolean wont
break.

Dominic

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320389
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Append Arrays with Structures

2009-03-11 Thread C S

 But it is odd, indeed, why return anything at all. 

It depends on the class. Some use it and some do not
http://java.sun.com/j2se/1.4.2/docs/api/java/util/AbstractCollection.html#add(java.lang.Object)


 I don't believe that it ever does return false and the docs do not
 indicate that it does. Indeed, it is almost certainly using the add
 method of the java AbstractList object (from which it inherits). This
 states that it returns true only. If there is an error, an exception
 is thrown.
 

It may not be due to the java link.  I found a reference that says ArrayAppend 
returned a boolean back in the days of CF 4.5.  So it may just be a carry over.

Though 


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320391
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Append Arrays with Structures

2009-03-11 Thread Dominic Watson

All speculation (though I'm sure someone here knows the answer for sure) but:

It may not be due to the java link.  I found a reference that says ArrayAppend 
returned a boolean back in the days of CF 4.5.  So it may just be a carry 
over.

This would suggest that it *would* be to do with the java link;
ColdFusion 4.5 was written in C++ ;)

Dominic

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320400
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Append Arrays with Structures

2009-03-11 Thread Dave Watts

 Nowhere states that the function returns a boolean ;) But it is odd,
 indeed, why return anything at all. I've done it myself in functions
 and justified it with 'One day I may have some logic that returns
 false and then the calling code that is checking for the boolean wont
 break.

CF functions have traditionally returned a Boolean value even when
this value doesn't indicate anything meaningful.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320402
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Append Arrays with Structures

2009-03-11 Thread C S

 It may not be due to the java link.  I found a reference that says 
 ArrayAppend returned a boolean back in the days of CF 4.5.  So it may 
 just be a carry over.
 
 This would suggest that it *would* be to do with the java link;
 ColdFusion 4.5 was written in C++ ;)
 

No, I just meant that the function returning a boolean at all probably had 
nothing to do with the java link.  Not that it could not hook into java's 
behavior if it wanted to ... ;-)  But Dave's explanation sounds pretty 
plausible to me. 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320410
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Append Arrays with Structures

2009-03-11 Thread Dominic Watson

Ah, we are at cross wires! I was citing the java method as a possible
reason for the function only ever returning true (or my suspicion that
it never returns false, in response to Adrian's question) - not for it
returning a boolean (which of course it does). Perhaps pre-6 it did
sometimes return false, though as David points out, CF has
traditionally followed this pattern so quite probably not. The docs
may have changed their wording to reflect the wording in the javadocs,
if indeed that is the method that is being used.

Anyways, I wonder if the OP has found his solution yet ;)

Dominic


2009/3/11 C S cfsearch...@yahoo.com:
 No, I just meant that the function returning a boolean at all probably had 
 nothing to do with the java link.  Not that it could not hook into java's 
 behavior if it wanted to ... ;-)  But Dave's explanation sounds pretty 
 plausible to m

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320416
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Append Arrays with Structures

2009-03-11 Thread C S

 Ah, we are at cross wires! 

Well that makes a lot more sense. That is what I get for only reading half of 
the thread ...

 Anyways, I wonder if the OP has found his solution yet ;)

Wait .. there was an OP? ;-)



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320419
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Append Arrays with Structures

2009-03-11 Thread James Holmes

*beats head on desk*

mxAjax / CFAjax docs and other useful articles:
http://www.bifrost.com.au/blog/


2009/3/12 Priya Koya priya23...@gmail.com:

 Is this right?

 cfset myarray = arrayNew(1)

 cfset session.pageList = arrayAppend( myarray, structNew() )

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320423
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Arrays

2009-03-01 Thread Will Tomlinson

Interesting Will. So does your outer-most structure have some sort of
incremental key? Personally an array of structs seems easier to me
because the array implies a series of something. As far as updating
and the code to deal with them it is pretty much 6 or 1/2 dozen I
would think.


I have a timeAdded key which I sort on using structSort(). 

cfset keyArray = structSort(cart, numeric, desc, timeAdded)

Then use the resulting array to loop over the cart. 

cfloop from=1 to=#arrayLen(keyArray)# index=thisKey
 pSKU: #keyArray[thisKey]# | Time Added: #cart[keyArray[thisKey]].timeAdded# 
| Price: #cart[keyArray[thisKey]].price#/p 
/cfloop

Will 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319952
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Arrays

2009-02-08 Thread Jason Congerton

Hi

I am currently getting trying to get my head arounds arrays. The shopping cart 
system i use, stores the cart details into an array. I need to be able to 
update the array with a figure at a certain point. Please see array structure 
below;

The place i need to enter is ITEMS, zone cost, drilled down by the item id.

i.e add zone cost to item array where ID EQ 12

I have had a look around, and i am thinking along the lines of array insert at?

Any help would be appreciated.

DecimalPlacesC 2  
DecimalPlacesW 2  
DiscountsDisplayIndex 1  
DisplayIndex 1  
ForceDecimalsC true  
ForceDecimalsW true  


Items array  
1 struct 
DeliveryCost 100.  
Description [empty string]  
FullDetails 1 The Cedar Ridge Playset (12)  
ID 12  
Name The Cedar Ridge Playset  
Price 651.304347826  
Quantity 1  
Ref SELWOOD-CEDARRIDGE-09  
TotalPrice 651.304347826  
TotalWeight 42  
Weight 42.00  
zoneCost 0.00  
 
2 struct 
DeliveryCost 50.  
Description [empty string]  
FullDetails 1 Cabin Package (18)  
ID 18  
Name Cabin Package  
Price 868.695652174  
Quantity 1  
Ref SELWOOD-CABIN-PCKG-09  
TotalPrice 868.695652174  
TotalWeight 130  
Weight 130.00  
zoneCost 0.00  
 
 
NumberDisplay 0  
Persistance 0  
SHIPPING array  
1 struct 
GetValue function WAEC_climbingframes_uk_Shipping_Charge 
Arguments: none 
ReturnType: Any
 
Roles:  
 
Access: public
 
Output:   
DisplayName:   
Hint:   
Description:   
 
 
IsActive true  
RuleName Shipping_Charge  
 
 
ShippingDisplayIndex 1  
ShippingIsTaxed true  
TAX array  
1 struct 
GetValue function WAEC_climbingframes_uk_VAT 
Arguments: none 
ReturnType: Any
 
Roles:  
 
Access: public
 
Output:   
DisplayName:   
Hint:   
Description:   
 
 
IsActive true  
RuleName VAT  
 
 
TaxDisplayIndex 1  
WeightAlign 1  
WeightSuffix oz  


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319036
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Arrays

2009-02-08 Thread Matt Williams

Hey Jason, if you don't already know which position in the array the
item id is located, then you'll need to loop through the array and
find it. Once found, you are actually dealing with a structure, so
updating is just a simple cfset. Something like this (assuming item id
is in session and new zoneCost coming from a form variable):

cfloop from=1 to=#arrayLen(Items)# index=i
  cfif Items[i].ID eq session.ID
cfset Items[i].zoneCost = form.zoneCost
  /cfif
cfloop

Does that make sense? I'm hoping I understand your question correctly.
Your post seemed to have a lot of extraneous info that I wasn't sure
if it was relevant.

-Matt

On Sun, Feb 8, 2009 at 5:36 AM, Jason Congerton
ja...@jasoncongerton.co.uk wrote:

 Hi

 I am currently getting trying to get my head arounds arrays. The shopping 
 cart system i use, stores the cart details into an array. I need to be able 
 to update the array with a figure at a certain point. Please see array 
 structure below;

 The place i need to enter is ITEMS, zone cost, drilled down by the item id.

 i.e add zone cost to item array where ID EQ 12

 I have had a look around, and i am thinking along the lines of array insert 
 at?

 Any help would be appreciated.

 DecimalPlacesC 2
 DecimalPlacesW 2
 DiscountsDisplayIndex 1
 DisplayIndex 1
 ForceDecimalsC true
 ForceDecimalsW true


 Items array
 1 struct
 DeliveryCost 100.
 Description [empty string]
 FullDetails 1 The Cedar Ridge Playset (12)
 ID 12
 Name The Cedar Ridge Playset
 Price 651.304347826
 Quantity 1
 Ref SELWOOD-CEDARRIDGE-09
 TotalPrice 651.304347826
 TotalWeight 42
 Weight 42.00
 zoneCost 0.00

 2 struct
 DeliveryCost 50.
 Description [empty string]
 FullDetails 1 Cabin Package (18)
 ID 18
 Name Cabin Package
 Price 868.695652174
 Quantity 1
 Ref SELWOOD-CABIN-PCKG-09
 TotalPrice 868.695652174
 TotalWeight 130
 Weight 130.00
 zoneCost 0.00


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319037
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Arrays

2009-02-08 Thread Jason Congerton

Hi Matt

Thanks for the reply, you understood correctly. I will now have a play with 
your code and post my results. I kind of thought i would have to loop through 
the array, but could work out how to update, and at the right position.

Thank you

Hey Jason, if you don't already know which position in the array the
item id is located, then you'll need to loop through the array and
find it. Once found, you are actually dealing with a structure, so
updating is just a simple cfset. Something like this (assuming item id
is in session and new zoneCost coming from a form variable):

cfloop from=1 to=#arrayLen(Items)# index=i
  cfif Items[i].ID eq session.ID
cfset Items[i].zoneCost = form.zoneCost
  /cfif
cfloop

Does that make sense? I'm hoping I understand your question correctly.
Your post seemed to have a lot of extraneous info that I wasn't sure
if it was relevant.

-Matt

On Sun, Feb 8, 2009 at 5:36 AM, Jas
 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319038
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Arrays

2009-02-08 Thread Will Tomlinson

I find a structure of structures to be better-understood, and easily updated. 

I have some example code from my cart if you want it.

Will


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319040
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Arrays

2009-02-08 Thread Matt Williams

On Sun, Feb 8, 2009 at 8:04 AM, Will Tomlinson w...@wtomlinson.com wrote:

 I find a structure of structures to be better-understood, and easily updated.

Interesting Will. So does your outer-most structure have some sort of
incremental key? Personally an array of structs seems easier to me
because the array implies a series of something. As far as updating
and the code to deal with them it is pretty much 6 or 1/2 dozen I
would think.

-- 
Matt Williams
It's the question that drives us.

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319041
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Arrays

2009-02-08 Thread Peter Boughton

An array of structs is effectively a query.

And having it in query form generally makes it easier to handle - much more 
powerful sorting and filtering (using QoQ).



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319043
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Arrays

2009-02-08 Thread Gaulin, Mark

Your point about being able to use QoQ is a good one.  It turns out that a 
query is actually implemented as a struct of arrays (where the struct key is 
the name of the column), and the most annoying thing about that is having to 
index the arrays by current row all of the time, vs a true array of structs, 
where each struct stands on its own (so you can pass the struct representing 
one row/object to a function, for example).  It can also be handy to be able to 
put different fields/data in each struct, and the true query model stinks for 
that.  
Thanks
   Mark



From: Peter Boughton [mailto:bought...@gmail.com]
Sent: Sun 2/8/2009 10:58 AM
To: cf-talk
Subject: Re: Arrays




An array of structs is effectively a query.

And having it in query form generally makes it easier to handle - much more 
powerful sorting and filtering (using QoQ).





~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319048
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Multi-dimentions Arrays

2008-06-11 Thread Kamru Miah
Hi Charlie, many thanks for your message. Yes, your tutorial is excellent for 
what I need to do; part3 (an array of structures) is most relevant. I am trying 
to adapt it to my problem, which is as follows.

There can be any number of (i.e. 2-digit) projects, each has a few overhead 
codes with a number of financial years (up to 6), each financial year will have 
a few types of costs (4) and each of these costs have to be divided between 12 
months.

So, I think I need an array of projects, which has structures of financial 
years and then another level of structures for monthly amounts? Does that sound 
reasonable? e.g. cfset projects[finYear][month] = StructNew(). Please advise. 
Regards, Kamru

i did a 3 part tutorial on arrays and structures that might be of some help.

http://tutorial171.easycfm.com/
http://tutorial172.easycfm.com/
http://tutorial173.easycfm.com/

check 'em out and see if they help wrap your brain around the concepts.

On Tue, Jun 10, 2008 at 7:04 AM, Kamru Miah [EMAIL PROTECTED] wrote:
 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

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


Multi-dimentions Arrays

2008-06-10 Thread Kamru Miah
Hi, I am new to developing code with multi-dimensional arrays (or structures). 
Could someone please advise me how to implement the following 4-level loops to 
store the financial values (for outputting at a later stage)?

---
Loop by projNo
  Loop by finYear
Loop by account type (4 types)
  Loop by month/period
[show monthly amount]
  End month/period
End loop account type
  End loop finYear
End projNo
---

Thanks in anticipation, Kamru 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

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


  1   2   3   4   5   >