Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Data Manipulation

Posted on 2003-03-23
6
Medium Priority
?
135 Views
Last Modified: 2013-12-24
I am currently working on a project which requires me to "sort" out the data that i retreive from a list. Here is what i have on the action page:

<CFinput type="checkbox" name="processing" value="#OrderNo#, #ProductNo#">
     <INPUT type="hidden" name="ProductNo" value="#GetInfo.ProductNo#">
     <INPUT type="hidden" name="OrderNo" value="#GetInfo.OrderNo#">

I have created a checkbox. For each order, there can be many items. When the selected checkboxes are checked, it will bring me to the action page. I have created a list on the action page which looks like this:

<cfloop index="check2" list="#form.cooking#">

  After this, I have to update the database according to the order number and product number. Currently, if i have 1 order and 2 items in that order my list will look like this "1,1,1,2". What i need is to sort out the data and update a table in the database. With the list i have now, the database would not be able to understand that order 1 has 2 items numbered product 1 and product 2.

  Thanks in advance to anybody who will spare some time to read the problem and help me out..
0
Comment
Question by:TBB
  • 3
  • 2
6 Comments
 
LVL 17

Accepted Solution

by:
anandkp earned 200 total points
ID: 8193593
change ur code to something like this
<CFinput type="checkbox" name="processing" value="#OrderNo#~#ProductNo#">

now ur list will become - "1~1,1~2"

using listsort get all the order in sorted manner

run a loop on this "," as delimeter & insert them in DB with then using "~" as the delimeter

so which is order no & whihc is itemno becomes obvious !

let me know

K'Rgds
Anand
0
 

Author Comment

by:TBB
ID: 8195203
I managed to make my list now to become "1~1,1~2" after modifying the list I created earlier and using the ~ as you told me to. Thanks for that.

This is the list that I have now in my action page:
<cfloop index="check2" list="#form.processing#" delimiters="check_delimiter">

However, I am trying to update the database. Sorry for not elaborating earlier. My database has a column name "processing" and data type is yes/no. I need to update the items table by using the list. I cant use delimeter to insert the data in the database as you mention. How do i write the "where" code so that the DB can be updated accordingly

<cfquery name="CreateFav" datasource="#application.DSN#">
Update Items
     set
     Items.processing = Yes
        Where ....
</cfquery>

Hope you can understand what i am trying to say.

Thanks again.
TBB
0
 
LVL 17

Expert Comment

by:anandkp
ID: 8200300
This shld be easy using listgtat()

i'll give a eg on how to use listgetat fucntions to suit ur needs
assuming
<cfset x = "1,2~2,2">

use listgtat(x,1,'~') - this will give u "1,2"
again use listgetat to determine the value of element u want from this list [1,2]
using this u can update it to yes/no

i am not able to put a eg u want as i dont know - how ur query strcture is wrt teh form elemets ...

but i hope this wld give u some idea on how to go abt doing it

let me know - if u need more help

K'Rgds
Anand
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
LVL 10

Expert Comment

by:substand
ID: 8216171
i'm not completely sure what you are trying to do... but I'll give it a shot:

<cfif listlen(form.processing) gt 0>
<cfset count=1>

<cfquery name="update" datasource="yourDSN">
update Items
set Items.processing = Yes
where
<cfloop list="#form.processing#" index="orderproduct">
<cfset count=count+1>
(ordernum=#listgetat(orderproduct,1,'~')# and productnum=#listgetat(orderproduct,2,'~')#)
<cfif listlen(form.processing) is not count> or </cfif>
</cfquery>

</cfif>

0
 

Author Comment

by:TBB
ID: 8217948
I think i got what i wanted already. I didnt exactly use what u mentioned but the part about using ~ as the delimeter and sorting the list were quite helpful. Thanks a lot anandkp :)
0
 
LVL 17

Expert Comment

by:anandkp
ID: 8222629
ok - i hope it got u thru with this ...

else let me know

K'Rgds
Anand
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
What You Need to Know when Searching for a Webhost Provider
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question