Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    updating splited values in a recordset

    Hi everyone,

    So here is my question.

    Image a table. There is a field. Name of field is ProductGroups

    In this field i have coma separeted values. For example like 10,20,30,40,etc...

    And i wanna delete one of this values. (Only 1 value) Lets say it is the value 20.

    Now, i do send this value (the 20) with form via method post.

    So what i need is, to delete the "20" there. of course i know this is not a real "delete" process. Cause i dont wanna delete whole row or field. Just the one value which i send. So this is more a "update" process.

    How should i do that ? I mean how must be selection from the field, the split etc...

    Shortly, the record which was 10,20,30,40 (same field and coma separeted)
    must be updated to 10,30,40 in the end.

    Thank you for help in advance.

  • #2
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    If at all possible, REDESIGN YOUR DATABASE.

    That is a *terrible* design. You should *NEVER* put a delimited list of values into a single database field.

    Instead, you should have ANOTHER table where you put ONE value per record.

    This is called NORMALIZATION. Google for the many many many articles about it.

    ********

    If for some reason you can't redesign the database--if it's a database you have no control over--then you are in for some really UGLY coding. But, yes, it is possible. Just a lot of work.
    Well it isnt a bad DB or DB design. But its a complex data and in the end of the day i need to do this. Cant explain now so long why it must be like this. But be sure there is for now no other way for me.

    I guess i will take the whole field, spilt the values and pull out the value i need, delete and update the field again with values which must be stay there. But yea its kinda complex work.

    If anybody has a shortcut for this process i would appricate for sharing. Tnx.

  • #3
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    Yes, it is a bad database design.

    ANY good database design tutorial will tell you so.

    Delimited fields in databases are the biggest mistake that amateur database designers make.

    But if you aren't interested in improving your design (and your overall performance times!) then yes, what you are saying you will do is a hacky and ugly but workable answer.
    Your 2 replies, sorry but just useless comments. It seems to me very clear that u are even not able to give a answer to my question. You are not obligated to give a answer or else. Also after your posts i dont wanna also a idea or comment from you.

    Just please stay KINDLY away from this topic.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •