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

Thread: Summary...

  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Location
    Loughborough (UK)
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Summary...

    Hello,

    How would I select the first X-number of characters from a DB text field so that I could provide a summary (or rather the intro) of particular communications stored in my db. For example, assume I have a tutorial or something with lots of words, i.e. a long piece of text, but I want to display the first sentence so that viewers can get the gist of it's content before opening it.

    Hope that makes sense, I would be really grateful for some pointers.

    Regards,

    Chris

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    The sunny side of the Alps
    Posts
    230
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't believe you can actually only retrieve first x characters from a particular field. You can, however, display only a part of the field. For example:

    Code:
    sField = rs("Field")
    
    'first 100 characters
    sDisplay = Left(sField,100) & "..."
    
    'all the text before a certain character - if you want first sentence you may use .
    sChr = "."
    sDisplay = Left(sField,Instr(sField,sChr))
    
    Response.Write sDisplay
    Bostjan

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    I am the luckiest man in the world


  •  

    Posting Permissions

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