Insert from Dynamically Generated Form
Hi I have created a form using a database table to supply the form fields; one of the fields is a check box, the other a text field. Please see code below, form name=add_delivery method=post action=cfoutput#CurrentPage#/cfoutput cfoutput query=get_delivery_types input type=hidden name=ga_del_type_id#get_delivery_types.currentrow# value=#ga_del_type_id# / input name=wp_delivery_active#get_delivery_types.currentrow# type=checkbox class=boxes id=wp_delivery_active#get_delivery_types.currentrow# value=yes / input type=text name=wp_delivery_cost#get_delivery_types.currentrow# id=wp_delivery_cost#get_delivery_types.currentrow# style=width:50px; value=#DecimalFormat(ga_del_guide_cost)# / /cfoutput input type=Hidden name=ResCount value=cfoutput#get_delivery_types.RecordCount#/cfoutput input name=submit type=submit class=submitBtn id=submit value=Update Delivery Options style=margin:0px; / /form I am using the following code to insert the record, however if all the check boxes are not checked, I get can not find form.wp_delivery_active3 error message. I know why I am getting this message, because the check box quite rightly does not exist if not completed. My question is, how do I create a cfif statement in the below code to specify no if form.wp_delivery_active3 is not present? Iâve tried a few, but to no avail. cfloop index=LoopCount from=1 to=#Val(form.ResCount)# cfset variables.ga_del_type_id=form.ga_del_type_id#Evaluate(LoopCount)# cfset variables.ga_del_type_id=#Evaluate(variables.ga_del_type_id)# cfset variables.wp_delivery_active=form.wp_delivery_active#Evaluate(LoopCount)# cfset variables.wp_delivery_active=#Evaluate(variables.wp_delivery_active)# cfset variables.wp_delivery_cost=form.wp_delivery_cost#Evaluate(LoopCount)# cfset variables.wp_delivery_cost=#Evaluate(variables.wp_delivery_cost)# cfquery datasource=#application.dsn# name=updateProducts INSERT INTO wp_delivery (wp_delivery_active, wp_delivery_detail, wp_delivery_product_id, wp_delivery_cost) VALUES ( cfqueryparam cfsqltype=cf_sql_bit value=#Variables.wp_delivery_active# , cfqueryparam cfsqltype=cf_sql_integer value=#variables.ga_del_type_id# , cfqueryparam cfsqltype=cf_sql_integer value=#wp_products_id# , cfqueryparam cfsqltype=cf_sql_integer value=#variables.wp_delivery_cost#) /cfquery /cfloop 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:318480 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Insert from Dynamically Generated Form
What about isdefined or using cfparam? -Original Message- From: Jason Congerton [mailto:ja...@jasoncongerton.co.uk] Sent: Sunday, January 25, 2009 3:59 AM To: cf-talk Subject: Insert from Dynamically Generated Form Hi I have created a form using a database table to supply the form fields; one of the fields is a check box, the other a text field. Please see code below, form name=add_delivery method=post action=cfoutput#CurrentPage#/cfoutput cfoutput query=get_delivery_types input type=hidden name=ga_del_type_id#get_delivery_types.currentrow# value=#ga_del_type_id# / input name=wp_delivery_active#get_delivery_types.currentrow# type=checkbox class=boxes id=wp_delivery_active#get_delivery_types.currentrow# value=yes / input type=text name=wp_delivery_cost#get_delivery_types.currentrow# id=wp_delivery_cost#get_delivery_types.currentrow# style=width:50px; value=#DecimalFormat(ga_del_guide_cost)# / /cfoutput input type=Hidden name=ResCount value=cfoutput#get_delivery_types.RecordCount#/cfoutput input name=submit type=submit class=submitBtn id=submit value=Update Delivery Options style=margin:0px; / /form I am using the following code to insert the record, however if all the check boxes are not checked, I get can not find form.wp_delivery_active3 error message. I know why I am getting this message, because the check box quite rightly does not exist if not completed. My question is, how do I create a cfif statement in the below code to specify no if form.wp_delivery_active3 is not present? Iââ¬â¢ve tried a few, but to no avail. cfloop index=LoopCount from=1 to=#Val(form.ResCount)# cfset variables.ga_del_type_id=form.ga_del_type_id#Evaluate(LoopCount)# cfset variables.ga_del_type_id=#Evaluate(variables.ga_del_type_id)# cfset variables.wp_delivery_active=form.wp_delivery_active#Evaluate(LoopCount)# cfset variables.wp_delivery_active=#Evaluate(variables.wp_delivery_active)# cfset variables.wp_delivery_cost=form.wp_delivery_cost#Evaluate(LoopCount)# cfset variables.wp_delivery_cost=#Evaluate(variables.wp_delivery_cost)# cfquery datasource=#application.dsn# name=updateProducts INSERT INTO wp_delivery (wp_delivery_active, wp_delivery_detail, wp_delivery_product_id, wp_delivery_cost) VALUES ( cfqueryparam cfsqltype=cf_sql_bit value=#Variables.wp_delivery_active# , cfqueryparam cfsqltype=cf_sql_integer value=#variables.ga_del_type_id# , cfqueryparam cfsqltype=cf_sql_integer value=#wp_products_id# , cfqueryparam cfsqltype=cf_sql_integer value=#variables.wp_delivery_cost#) /cfquery /cfloop 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:318481 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Insert from Dynamically Generated Form
Hi Can't believe Iâve been such a numpty, the isdefined statement I was trying had an error in the format missing bracket!! Corrected the bracket issue, works fine... cfif IsDefined(form.wp_delivery_active#Evaluate(LoopCount)#) cfset variables.wp_delivery_active=form.wp_delivery_active#Evaluate(LoopCount)# cfset variables.wp_delivery_active=#Evaluate(variables.wp_delivery_active)# cfelse cfset variables.wp_delivery_active=no /cfif Kind Regards 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:318482 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Insert from Dynamically Generated Form
Use structKeyExists(); it's neater and it can perform better. Also, the evaluate()s are unnecessary. This; cfset variables.ga_del_type_id=form.ga_del_type_id#Evaluate(LoopCount)# cfset variables.ga_del_type_id=#Evaluate(variables.ga_del_type_id)# is an unnecessarily complicated way of doing cfset variables.ga_del_type_id= form[ga_del_type_id LoopCount] which is far more readable. You could also avoid the whole isdefined/structkeyexists issue by looping directly through the form struct as a collection. mxAjax / CFAjax docs and other useful articles: http://www.bifrost.com.au/blog/ 2009/1/25 Jason Congerton ja...@jasoncongerton.co.uk: Hi Can't believe I've been such a numpty, the isdefined statement I was trying had an error in the format missing bracket!! Corrected the bracket issue, works fine... cfif IsDefined(form.wp_delivery_active#Evaluate(LoopCount)#) cfset variables.wp_delivery_active=form.wp_delivery_active#Evaluate(LoopCount)# cfset variables.wp_delivery_active=#Evaluate(variables.wp_delivery_active)# cfelse cfset variables.wp_delivery_active=no /cfif Kind Regards 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:318483 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Flat File as a Database?
Hello everyone, I have a need to build a site which will not have access to a database. Instead, the client has specified that I must use a flat file. On this flat file, I need to be able insert, update, and select Honestly, I don't even know where to start. Anyone have any idea how to go about this? Is there a udf or cfc out there that would help me? Thank you for your time. bob ~| 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:318484 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Flat File as a Database?
Why can't you use a database? Is the client just being an idiot, or is there a legitimate reason for it? If you're on CF8 or Railo, you can serialize/deserialize your query objects, so you could store the data as a flat CFML/JSON file, but act on it using Query of Queries. But first I would explore why you apparently can't use a database. ~| 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:318485 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Flat File as a Database?
Why can't you use a database? Is the client just being an idiot, or is there a legitimate reason for it? If you're on CF8 or Railo, you can serialize/deserialize your query objects, so you could store the data as a flat CFML/JSON file, but act on it using Query of Queries. But first I would explore why you apparently can't use a database. ~| 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:318486 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Using CFloop to pull data from CFC
I am having trouble pulling data from a cfc for a pull down menu. Here is the code from the cfm file: div id=sprynavHor style=z-index:100 ul id=MenuBar1 class=MenuBarHorizontal style=z-index:120 li a href=/store/index.cfm?action=editRequest class=navbarCatalog Request/a/li li a class=navbarOur Products /a cfinvoke component=cfc.getCategories method=getCategories returnvariable=getCategories/ ul cfloop index=Title array=#getCategories# li cfoutputa class=MenuBarItemSubmenu#Title#/a /cfoutput/li /cfloop /ul /li li a href=/store/index.cfm?action=showWCITrackerForm class=navbarTrack a Shipment/a/li lia class=MenuBarItemSubmenu href=##Customer Service/a ul lia href=/store/index.cfm/links class=navbarIndustry Links/a/li li a href=/store/index.cfm/terms class=navbarTerms amp; Conditions/a/li li a href=/store/index.cfm/warranty class=navbarWarranty/a/li lia href=/store/index.cfm/about class=navbarAbout Us/a/li /ul /li /li li a href=/store/index.cfm?action=showSearchStoresForm class=navbarFind a Reseller/a/li /ul /div The CFC has the method getCategories and is set up like this: cfcomponent output=false cfset THIS.dsn=wci09.grfxs.com cffunction name=getCategories access=remote returntype=array !--- Define variables --- cfset var getCategoriesListBox= cfset var ID= cfset var result=ArrayNew(2) cfset var i=0 cfquery name=getCategoriesListBox datasource=#THIS.dsn# SELECT ID, Title, URLalias FROM categories WHERE memberOf=0 AND active=1 /cfquery !--- Convert results to array --- cfloop index=i from=1 to=#getCategoriesListBox.RecordCount# cfset result[i][1]=getCategoriesListBox.ID[i] cfset result[i][2]=getCategoriesListBox.Title[i] cfset result[i][3]=getCategoriesListBox.URLalias[i] /cfloop !--- And return it --- cfreturn result /cffunction !--- Get subcats for each cat --- cffunction name=getSubCats access=remote returnType=array cfargument name=ID type=string required=true !--- Define variables --- cfset var getSubCatsbyID= cfset var result=ArrayNew(2) cfset var i=0 !--- Get data --- cfquery name=getSubCatsbyID datasource=#THIS.dsn# SELECT Title, URLalias, ID FROM categories WHERE memberOF=#ARGUMENTS.ID# AND active=1 AND deleted=0 /cfquery !--- Convert results to array --- cfloop index=i from=1 to=#getSubCatsbyID.RecordCount# cfset result[i][1]=getSubCatsbyID.URLalias[i] cfset result[i][2]=getSubCatsbyID.Title[i] cfset result[i][3]=getSubCatsbyID.ID[i] /cfloop !--- And return it --- cfreturn result /cffunction /cfcomponent How do I set up the CFloop to pull the data from the CFC? Help is appreciated! PAtrick patgrfxs (AIM and Yahoo) ~| 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:318487 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Using CFloop to pull data from CFC
You need to return and loop over result (what is being returned from your component), not the method name. I am having trouble pulling data from a cfc for a pull down menu. Here is the code from the cfm file: div id=sprynavHor style=z-index:100 ul id=MenuBar1 class=MenuBarHorizontal style=z-index:120 li a href=/store/index.cfm?action=editRequest class=navbarCatalog Request/a/li li a class=navbarOur Products /a cfinvoke component=cfc.getCategories method=getCategories returnvariable=getCategories/ ul cfloop index=Title array=#getCategories# li cfoutputa class=MenuBarItemSubmenu#Title#/a /cfoutput/li /cfloop /ul /li li a href=/store/index.cfm?action=showWCITrackerForm class=navbarTrack a Shipment/a/li lia class=MenuBarItemSubmenu href=##Customer Service/a ul lia href=/store/index.cfm/links class=navbarIndustry Links/a/li li a href=/store/index.cfm/terms class=navbarTerms amp; Conditions/a/li li a href=/store/index.cfm/warranty class=navbarWarranty/a/li lia href=/store/index.cfm/about class=navbarAbout Us/a/li /ul /li /li li a href=/store/index.cfm?action=showSearchStoresForm class=navbarFind a Reseller/a/li /ul /div The CFC has the method getCategories and is set up like this: cfcomponent output=false cfset THIS.dsn=wci09.grfxs.com cffunction name=getCategories access=remote returntype=array !--- Define variables --- cfset var getCategoriesListBox= cfset var ID= cfset var result=ArrayNew(2) cfset var i=0 cfquery name=getCategoriesListBox datasource=#THIS.dsn# SELECT ID, Title, URLalias FROM categories WHERE memberOf=0 AND active=1 /cfquery !--- Convert results to array --- cfloop index=i from=1 to=#getCategoriesListBox.RecordCount# cfset result[i][1]=getCategoriesListBox.ID[i] cfset result[i][2]=getCategoriesListBox.Title[i] cfset result[i][3]=getCategoriesListBox.URLalias[i] /cfloop !--- And return it --- cfreturn result /cffunction !--- Get subcats for each cat --- cffunction name=getSubCats access=remote returnType=array cfargument name=ID type=string required=true !--- Define variables --- cfset var getSubCatsbyID= cfset var result=ArrayNew(2) cfset var i=0 !--- Get data --- cfquery name=getSubCatsbyID datasource=#THIS.dsn# SELECT Title, URLalias, ID FROM categories WHERE memberOF=#ARGUMENTS.ID# AND active=1 AND deleted=0 /cfquery !--- Convert results to array --- cfloop index=i from=1 to=#getSubCatsbyID.RecordCount# cfset result[i][1]=getSubCatsbyID.URLalias[i] cfset result[i][2]=getSubCatsbyID.Title[i] cfset result[i][3]=getSubCatsbyID.ID[i] /cfloop !--- And return it --- cfreturn result /cffunction /cfcomponent How do I set up the CFloop to pull the data from the CFC? Help is appreciated! PAtrick patgrfxs (AIM and Yahoo) ~| 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:318488 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Using CFloop to pull data from CFC
That is, returnvariable=result, and then loop over result. You need to return and loop over result (what is being returned from your component), not the method name. ~| 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:318489 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Flat File as a Database?
Um, did you reply there? Just getting my message quoted... ~| 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:318490 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Flat File as a Database?
Honestly, I don't even know where to start. If the client is that stupid, use an Access database, and tell him it's a flat file. And don't tell him it's a database... And here is a better advice: find yourself another client! ~| 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:318491 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Using CFloop to pull data from CFC
thanks I have got past this. Pat /grfxs ~| 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:318492 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Flat File as a Database?
Umm... I have never thought it a good business practice to call a client stupid. Just my .02 Speeves On 1/25/09, Claude Schneegans schneeg...@internetique.com wrote: Honestly, I don't even know where to start. If the client is that stupid, use an Access database, and tell him it's a flat file. And don't tell him it's a database... And here is a better advice: find yourself another client! ~| 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:318493 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Flat File as a Database?
Flat file is a type of database. Many flat file databases support SQL at some level. You should really clarify what the client is requesting here. If they are specifically requesting a flat file database instead of a relational database then there is a good chance that they have a specific product in mind. If you meant to write text file instead of flat file then you should clarify that in your question since a text file you create yourself is very different from a flat file database product that might cost thousands of dollars. -Mike Chabot On Sun, Jan 25, 2009 at 12:51 PM, Bob Wright thecfprogram...@gmail.com wrote: Hello everyone, I have a need to build a site which will not have access to a database. Instead, the client has specified that I must use a flat file. On this flat file, I need to be able insert, update, and select Honestly, I don't even know where to start. Anyone have any idea how to go about this? Is there a udf or cfc out there that would help me? Thank you for your time. bob ~| 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:318494 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Flat File as a Database?
I know you can define a text file (csv, txt) as an ODBC database. I have played with it a bit trying to import some stuff from a text document but nothing past doing a simple select statement. You can define delimiters and all that. G! On Sun, Jan 25, 2009 at 12:51 PM, Bob Wright thecfprogram...@gmail.comwrote: Hello everyone, I have a need to build a site which will not have access to a database. Instead, the client has specified that I must use a flat file. On this flat file, I need to be able insert, update, and select Honestly, I don't even know where to start. Anyone have any idea how to go about this? Is there a udf or cfc out there that would help me? Thank you for your time. bob ~| 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:318495 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Flat File as a Database?
I have never thought it a good business practice to call a client stupid. Calling him stupid, no, but get rid of him yes! ~| 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:318496 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Flat File as a Database?
Hello everyone, I have a need to build a site which will not have access to a database. Instead, the client has specified that I must use a flat file. On this flat file, I need to be able insert, update, and select Honestly, I don't even know where to start. Anyone have any idea how to go about this? Is there a udf or cfc out there that would help me? Thank you for your time. bob As it has been implied, probably we need to start from the Objective of the Project (site) to begin with, then we would know what sort of backend would be adequate for it... just a thought. Don Chunshen Li ~| 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:318497 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Creating a struct while not knowing node names
I'm working a CFC web service where I want to return a JSON string; I don't necessarily know my table's column names ahead of time. I am able to pull out the table's column names and am trying to use them as my struct's node names. When I try to dump them out, I get the string IDX rather than the actual struct. cfset LOCAL = ArrayNew(1) cfset cnt = 1 cfquery name=getColNames datasource=foo SELECT column_name fromINFORMATION_SCHEMA.Columns where table_name = 'users' order by column_name /cfquery cfset sColNames = valuelist(getColNames.column_name) cfquery name=getDis datasource=foo SELECT * FROM users where emplid in (#emplids#) ORDER BY empname /cfquery cfloop query=getDis cfset LOCAL[cnt] = structnew() cfloop list=#sColNames# index=idx cfset LOCAL[cnt].idx = evaluate(getDis. idx) /cfloop cfset cnt = cnt + 1 /cfloop Any ideas? tia, - Joe ~| 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:318498 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Creating a struct while not knowing node names
cfloop list=#sColNames# index=idx cfset LOCAL[cnt].idx = evaluate(getDis. idx) /cfloop Use cfset LOCAL[cnt][idx] = getDis[idx] there instead. ~| 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:318499 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Flat File as a Database?
Hi Bob Use a embedded database like H2. This will solve your problem. It is a flat file that you can use with the normal cfquery. Kind Regards, Nitai On Jan 25, 2009, at 6:51 PM, Bob Wright wrote: I have a need to build a site which will not have access to a database. Instead, the client has specified that I must use a flat file. On this flat file, I need to be able insert, update, and select Honestly, I don't even know where to start. Anyone have any idea how to go about this? -- Razuna On-Demand - Hosted Digital Asset Management Solution Razuna - Open Source Digital Asset Management with Web Content Management http://www.razuna.com/ Kabunto - Open Source Forum Solution http://www.kabunto.org/ Roozani - memorize everywhere http://www.roozani.com/ SixSigns - Enrich peoples lives and web experience http://www.sixsigns.com http://blog.sixsigns.com Follow us on Twitter http://twitter.com/sixsigns ~| 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:318500 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Removing spaces from a string?
Trim will only remove leading and trailing spaces. If you want to remove all spaces, Replace(StringVar, , , all) Rob At 08:59 PM 6/28/2003 +0200, cf-t...@sdsolutions.de wrote: This is correct: (and a little old to reply, but wanted to have it correct for future people who read this.. Replace(StringVar, , , all) Need quotes around ALL ~| 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:318501 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Creating a struct while not knowing node names
Wait, are you converting a query to a structure of arrays just so you can then convert that to JSON? If so, stop it - it's unnecessary. If you're on CF8 you can add cffunction attributes returnformat=JSON and queryformat=row|column as appropriate and just cfreturn the query. If you're on CF7 you can use cfjson which is a CFC that will serialise/deserialise for you http://cfjson.riaforge.org/ And while I'm here, that query should have a cfqueryparam in it. cfquery name=getDis datasource=foo SELECT * FROM users where emplid in (cfqueryparam list=true value#emplids# cfsqltype=cf_sql_integer/) ORDER BY empname /cfquery And, *if* you really do need to create your own array of structures, you can drop that initial query and just do this: cfloop query=getDis cfset LOCAL[getDis.CurrentRow] = StructNew() cfloop list=#getDis.ColumnList# index=ColName cfset LOCAL[getDis.CurrentRow][ColName] = getDis[ColName][getDis.CurrentRow] /cfloop /cfloop Not the CurrentRow and ColumnList properties of the query, saves you creating other variable that do the same job. ~| 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:318502 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Creating a struct while not knowing node names
Always so close yet so far away... That did it - thanks a lot!!! ~| 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:318503 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
From and ReplyTo address, CFMAIL and Spam filters...
Recently have seen some emails vanish without being delivered from various forms on a particular site. Been working great past four years with no trouble, so was a head scratcher... After going back and forth with HostMySite a number of times, the only thing we could could come up with was that the from field was using the senders address entered into the form, and since that was usually a different domain than the mail server, was possibly getting filtered out along the path to be delivered because it looked like a spoof. In other words - the server the site was using mail.mysite.com and the sender email from the form would be b...@whateverhostbobhas.com. They suggested switching all cfmail from parameters to a trusted address like fo...@mysite.com, and simply having the address of the sender in the body somewhere. Sound about right to you folks? This sorta thing wasn't an issue four years ago when this particular site was put together. My client is hesitant to switch the sending address, because they just want to be able to hit 'reply' and not have to do anything else. Having Bob's email address as the replyto would solve that. So, what about the replyto attribute? Does that one matter as far as spam/spoof filters go, in any body's opinion? ~| 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:318504 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Adobe Bolt anyone?
Actually, the Adobe NDA explicitly states that you cannot even admit the existence of the beta software, among numerous other things. I suggest you reread the NDA, because you just violated it. On Fri, Jan 23, 2009 at 8:05 PM, Eric Roberts ow...@threeravensconsulting.com wrote: That is incorrect...I am on the CF9 alpha...there is nothing to stop one from admitting they are on the alpha or the beta. Eric ~| 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:318505 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Adobe Bolt anyone?
So if you know what the NDA says, then that must mean you've read the NDA and thus are part of an Abode prerelease program. Does this mean you just violated your NDA by saying you read the NDA? I'm just wondering. Not that I have any knowledge of the NDA or if it even exists. Wil Genovese One man with courage makes a majority. -Andrew Jackson A fine is a tax for doing wrong. A tax is a fine for doing well. On Jan 25, 2009, at 5:53 PM, Brian Kotek wrote: Actually, the Adobe NDA explicitly states that you cannot even admit the existence of the beta software, among numerous other things. I suggest you reread the NDA, because you just violated it. On Fri, Jan 23, 2009 at 8:05 PM, Eric Roberts ow...@threeravensconsulting.com wrote: That is incorrect...I am on the CF9 alpha...there is nothing to stop one from admitting they are on the alpha or the beta. Eric ~| 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:318506 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: From and ReplyTo address, CFMAIL and Spam filters...
IMO, you should definitely be sending _from_ an address at the site's domain. Simply place the form respondent's email address in the replyto attribute of cfmail. cfmail from=mysendaddr...@mydomain.com replyto=#form.respondentEmail# // message /cfmail HTH. ~| 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:318507 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Adobe Bolt anyone?
Unbelievable. God forbid anyone get even the tiniest glimpse of the tools that they use to make their living. For the love of what ever you believe in, who here has read the terms of a prerelease or any other click here to accept license? God forbid that the stewards of CF squander any more of its monster market share by allowing people to even talk about the very existence of the next version of CF or it's IDE. Especially when they publicly, and proudly, announced the fact that they had twice the ppl enter into beta testing of a dead language? It is not like Bolt will have anything over any other IDE or coding tool out there. Seriously, can Adobe pack six years of catch up ball (I am talking the nonexistance of a vender supported dedicated IDE) into one year with the likes of MS Visual Studio, Flex Builder, NetBeans, Eclipse, Aptana, Zend Studio or Komodo? If it does I will order it on the spot. Flame on, G! On Sun, Jan 25, 2009 at 6:59 PM, Wil Genovese jugg...@visi.com wrote: So if you know what the NDA says, then that must mean you've read the NDA and thus are part of an Abode prerelease program. Does this mean you just violated your NDA by saying you read the NDA? I'm just wondering. Not that I have any knowledge of the NDA or if it even exists. Wil Genovese One man with courage makes a majority. -Andrew Jackson A fine is a tax for doing wrong. A tax is a fine for doing well. On Jan 25, 2009, at 5:53 PM, Brian Kotek wrote: Actually, the Adobe NDA explicitly states that you cannot even admit the existence of the beta software, among numerous other things. I suggest you reread the NDA, because you just violated it. On Fri, Jan 23, 2009 at 8:05 PM, Eric Roberts ow...@threeravensconsulting.com wrote: That is incorrect...I am on the CF9 alpha...there is nothing to stop one from admitting they are on the alpha or the beta. Eric ~| 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:318508 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Adobe Bolt anyone?
Where...I even double checked it and didn't see anything the last time we had this discussion/comic dialogue... Eric Brian Kotek wrote: Actually, the Adobe NDA explicitly states that you cannot even admit the existence of the beta software, among numerous other things. I suggest you reread the NDA, because you just violated it. On Fri, Jan 23, 2009 at 8:05 PM, Eric Roberts ow...@threeravensconsulting.com wrote: That is incorrect...I am on the CF9 alpha...there is nothing to stop one from admitting they are on the alpha or the beta. Eric ~| 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:318509 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
SQL query sorting problem
DBMS is MySQL 5. I have a report that is generated for cities within several states. The states are designated by their two letter postal abbreviations and are in a certain order. For example: 1. NY 2. CA 3. FL I would like the records of the report sorted by the original state order, then by city name. I can pull the data for the report in single query, but can't figure out how to maintain the state order. Turning the state list above into a comma delimmited list (NY,CA,FL), my query looks something like: SELECT * FROM cities WHERE state IN (cfqueryparam value=#states# list=yes) ORDER BY state, city Except that I lose the original order of the state list. There are a number of workarounds, such as looping through the states and doing one query for each. Or run the single query shown above and then in a similar manner loop through the states and do a QoQ for each. Is there a way to do this in a single query? ~| 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:318510 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: SQL query sorting problem
rty a UNION query generated inside a cfloop: cfquery ... cfloop from=1 to=#listlen(states)# index=j (SELECT *, #j# AS sortcol FROM cities WHERE state = '#listgetat(states, j)#') cfif j lt listlen(states)UNION /cfif /cfloop ORDER BY sortcol, city /cfquery you could also probably build a dynamic CASE statement instead of using a UNION query, but i will need to check up the syntax of that... Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ Jim McAtee wrote: DBMS is MySQL 5. I have a report that is generated for cities within several states. The states are designated by their two letter postal abbreviations and are in a certain order. For example: 1. NY 2. CA 3. FL I would like the records of the report sorted by the original state order, then by city name. I can pull the data for the report in single query, but can't figure out how to maintain the state order. Turning the state list above into a comma delimmited list (NY,CA,FL), my query looks something like: SELECT * FROM cities WHERE state IN (cfqueryparam value=#states# list=yes) ORDER BY state, city Except that I lose the original order of the state list. There are a number of workarounds, such as looping through the states and doing one query for each. Or run the single query shown above and then in a similar manner loop through the states and do a QoQ for each. Is there a way to do this in a single query? ~| 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:318511 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Flat File as a Database?
Thanks all for the replies. It sounds like some of you are in a position to fire clients. But since I get paid by the job, I can't just do that. Maybe someday, but not today. Besides, the client is not an idiot. I'm sorry, I can't go into detail about the reasons why we are limited to a flat file. But the reasons are legitimate, and cannot be circumvented. Absolutely no database can be installed. It is what it is. Yes, I get that if I can find a solution here, the flat file will be effectively a database. But hey, it's all about meeting the criteria. And a flat file absolutely will do just that. As far as what we need to accomplish, it is nothing more than basic CRUD via web forms with data download capabilities. Nothing fancy. No interface to other applications or products. Just simple CRUD on a stand-alone application. Gerald, I had not thought of ODBC text file thing. I have seen it over the years, but never messed with it. I'll look into that, thanks. Nitai, H2 looks interesting, but I can't use it here. Thanks anyway. Peter, I did reply to you earlier (from the house of fusion website). Not sure what happened. Basically, I said that all I had available to me was CF7. bob ~| 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:318512 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Flat File as a Database?
Hi Bob, OK so you want a flat file. Does it have to be that or is the criteria really No database? What we don't know is your overall site design, is the database going to be big, hundreds/thousands/millions of entries, etc? If it not ridiculously big and depending on what you need to so in terms of querying have you considered keeping all of your data in memory and just saving to disk for security using XML, a WDDX packet being super-easy in this context. Alternatively have you thought of using the file system as a database? A popular email server does just that very effectively for its account database. Top folders are tables, then break it up below that depending on what your data structure is. food for thought :-) Kym you wrote: Thanks all for the replies. It sounds like some of you are in a position to fire clients. But since I get paid by the job, I can't just do that. Maybe someday, but not today. Besides, the client is not an idiot. I'm sorry, I can't go into detail about the reasons why we are limited to a flat file. But the reasons are legitimate, and cannot be circumvented. Absolutely no database can be installed. It is what it is. Yes, I get that if I can find a solution here, the flat file will be effectively a database. But hey, it's all about meeting the criteria. And a flat file absolutely will do just that. As far as what we need to accomplish, it is nothing more than basic CRUD via web forms with data download capabilities. Nothing fancy. No interface to other applications or products. Just simple CRUD on a stand-alone application. Gerald, I had not thought of ODBC text file thing. I have seen it over the years, but never messed with it. I'll look into that, thanks. Nitai, H2 looks interesting, but I can't use it here. Thanks anyway. Peter, I did reply to you earlier (from the house of fusion website). Not sure what happened. Basically, I said that all I had available to me was CF7. bob ~| 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:318513 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Flat File as a Database?
Hi Kym, thanks for the reply. Very good question. The criteria is really No Database. There is more detailed and specific language than that, but it pretty much sums it up. As you pointed out, a filesystem is certainly a database, of sorts. I have been pondering it. It seems a bit messy though. Still, it is my fall-back plan, if I can't get find a flat file solution. But, it is not my preference. We expect not more than ten thousand entries. Likely not more than a few thousand. I would not want to risk keeping the data in memory, with periodic writes to disc. Not with this project. Thanks again. bob ~| 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:318514 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4