Professional Web Applications Themes

Pulling part of test out of a field in a database? - Macromedia ColdFusion

I have a MySQL Database that has a description field, desribing the unit. At the end of that description it has a location. For instance. "Description Description Description Description Description Description Location: California" What I ant to do is just pull "Location: California" Anyone know how to do this in Coldfusion? Lou...

  1. #1

    Default Pulling part of test out of a field in a database?

    I have a MySQL Database that has a description field, desribing the unit. At
    the end of that description it has a location. For instance. "Description
    Description Description Description Description Description Location:
    California" What I ant to do is just pull "Location: California" Anyone know
    how to do this in Coldfusion?
    Lou

    lazerbrains555 Guest

  2. #2

    Default Re: Pulling part of text out of a field in a database?

    The following code will take your string and find the starting point of your
    substring and returning just the end of the entire string:
    <cfoutput>#Right(String, (Len(String) - FindNoCase('Location:', String)) +
    1)#</cfoutput>

    TA-Selene Guest

  3. #3

    Default Re: Pulling part of text out of a field in a database?

    Thanks for the response, and this might be a dumb question but, don't I need to tell it what field? Where would that go into the code you posted?


    lazerbrains555 Guest

  4. #4

    Default Re: Pulling part of text out of a field in a database?

    You would change the references to 'String' in my code to your field/variable name.
    TA-Selene Guest

  5. #5

    Default Re: Pulling part of text out of a field in a database?

    My field nam is "lDescription". I Wrote it like this,
    "<cfoutput>#Right(lDescription, (Len(lDescription) - FindNoCase("Location:",
    lDescription)) + 1)#</cfoutput>". When I tested it, it still pulls the entire
    field and not just from "Location" on. Any ideas? Or am I doing something
    wrong?

    lazerbrains555 Guest

  6. #6

    Default Re: Pulling part of text out of a field in a database?

    Is Location followed by a colon, like I have in the code? If not, remove it.
    If you are having problems, break the code apart. You need to make sure the
    FindNoCase() function returns a value greater than zero or else your entrie
    string will be returned.

    TA-Selene Guest

  7. #7

    Default Re: Pulling part of text out of a field in a database?

    Thank you very much. I was a moron. I double checked the database and it was "Locations:" plural. It works perfectly now. Thank you sooo much for your help.


    lazerbrains555 Guest

Similar Threads

  1. pulling visible versus actual field value
    By David_Cuffee@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 0
    Last Post: January 3rd, 11:09 PM
  2. Pulling from Database
    By groh in forum Dreamweaver AppDev
    Replies: 1
    Last Post: May 4th, 04:36 AM
  3. Pulling BLOBs from Database
    By jl_forum in forum Coldfusion Database Access
    Replies: 1
    Last Post: March 30th, 08:05 AM
  4. pulling stuff from comma-delimited field
    By middletree in forum ASP
    Replies: 3
    Last Post: August 13th, 03:39 PM
  5. Pulling images out of a database
    By Murray *TMM* in forum Macromedia Dreamweaver
    Replies: 3
    Last Post: July 9th, 08:34 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