Professional Web Applications Themes

Appending data to a db field - Macromedia ColdFusion

Hello all, I'm creating a simple support log application for our computer technician and I'm having trouble with one ascpect. I have an Access DB with an 'issue_description' field (type='memo') for the description of the issue. I would like the technician to be able to add information to this field but not change any existing information. Preferrably, what I'd like to do, is add text to the issue_description field with a datestamp. For example, if the issue_description field contained the following: 'Can't open attachment in Outlook' I would like to display the current issue_description and allow the technician to add ...

  1. #1

    Default Appending data to a db field

    Hello all,

    I'm creating a simple support log application for our computer technician and
    I'm having trouble with one ascpect.

    I have an Access DB with an 'issue_description' field (type='memo') for the
    description of the issue.
    I would like the technician to be able to add information to this field but
    not change any existing information.
    Preferrably, what I'd like to do, is add text to the issue_description field
    with a datestamp. For example, if the issue_description field contained the
    following:

    'Can't open attachment in Outlook'

    I would like to display the current issue_description and allow the technician
    to add details to the field (but not edit any existing data) with the resulting
    text added to the issue_description field with a timestamp, so that after
    adding comments the issue_description field would look like this:


    Can't open attachment in Outlook'

    Addition Details add: May 6, 2005 12:05:03PM
    attempted to contact - unavailable

    Addition Details add: May 7, 2005 1:03:03PM
    Second attempt to contact - unavailable

    etc, etc,

    I have't discovered a way to do this. I'd even settle for being able to add
    additional text without the timestamp.
    Any suggestions are much appreciated.

    Cheers,
    Gord.




    gbert Guest

  2. #2

    Default Re: Appending data to a db field

    Keep the seperate text entries in their own table. Then you can have the ID of the job the memo field and a date time field.

    The just call all the relevant records and output them.

    Make sense?
    Stressed_Simon Guest

  3. #3

    Default Re: Appending data to a db field

    Hi Simon,

    Thank you for the quick response!
    That sounds like an efficient and practical solution.

    I'm a CF beginner so I'm curious - is there a way to do it by adding to the
    field?
    I could see some benefit to having all the data in one field in some
    cirstances.

    Cheers,
    Gord.

    gbert Guest

  4. #4

    Default Re: Appending data to a db field

    To add the data to the end all you have to do is call the data from the
    database. Then use cfset to add the new data to the end.

    ie <cfset NewVal = qCurrentData.MemoField & ExtraInfo>

    Then just use SQL to replace the original value with the new one.

    I would suggest that you go with my first suggestion as it will be much more
    powerful and quick.

    This is not really a CF thing as you would approach it like this for any
    database drive app. I would get a good book on SQL and how to build relational
    databases, as this will help you make better databse decisions.

    Good luck.

    Stressed_Simon Guest

  5. #5

    Default Re: Appending data to a db field

    Thanks again Simon,

    I will pick up some reading material on relational databases - do you have any
    suggestions?

    If I may, I have one more question regarding date/time values. I would like to
    be able to get a string value timestamp in the same form as the
    CreateODBCDateTime value. Is there a way to convert the CreateODBCDateTime to a
    strong, or even better get the system date/time returned as a string value from
    one function?

    Cheers.

    gbert Guest

  6. #6

    Default Re: Appending data to a db field

    I would also agree with simon on his suggestion.

    But to append the data, there is no need to read it first, just append in the
    query

    Update myTable
    Set myField = myField + #Chr(10)# + '#Now()#' + #Chr(10)# + '#form.text#'
    Where myId = form.myId

    Ken

    The ScareCrow Guest

Similar Threads

  1. Comparing current field data with last entry for field
    By ccnorris in forum Coldfusion - Advanced Techniques
    Replies: 8
    Last Post: June 1st, 03:20 AM
  2. Send data to form field
    By Ken_iversen in forum Dreamweaver AppDev
    Replies: 4
    Last Post: April 15th, 11:44 PM
  3. Seperating data within a field
    By Darren in forum ASP Database
    Replies: 10
    Last Post: April 2nd, 01:17 PM
  4. Data field formatting
    By RIDVAN AKDEMIR in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: October 3rd, 02:08 PM
  5. Replies: 1
    Last Post: August 1st, 07:32 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139