limiting a rs text field

Results 1 to 3 of 3

Thread: limiting a rs text field

  1. #1
    Join Date
    Dec 1969

    Default limiting a rs text field

    I need to limit one of my returned recordsets in a a table from a search form.<BR>One field of the table contains a summary ( a memo field) which can be up to a page long.<BR>I would like only to return the first 100 characters of this field so that my page is not a mile long.<BR><BR>How is this achieved?<BR><BR>What would be really interesting is if the 50 characters could be surrounding the entered keyword. <BR>ie the user searches for &#039law&#039 and the returned field would be<BR>bla bla bla ...(*49) &#060;bold&#062;law&#060;/bold&#062; bla bla bla ... (*49)<BR>but i cannot for the life of me work out how to do either of these things.<BR>any ideas?

  2. #2
    Crimedog Guest

    Default Doesn't look good.

    I don&#039t know of a way to do it in the return. You may have to do the old fashioned:<BR>"Copy to variable"<BR>"Search Variable char by char, counting as you go"<BR>"Set up a Left and Right (or some version of Trim) to get rid of extraneous stuff based on numbers you counted above"<BR><BR>I forsee type mismatch, but that is just a guess. I dunno if you can stuff a memo field into a variant. This would also be processor intensive....<BR><BR>Good luck

  3. #3
    SPG Guest

    Default Possible solution

    Easy way:<BR><BR>left(objRS("memo"), 100) & "..."<BR><BR>Tricky way:<BR><BR>i = inStr(objRS("memo"), strWord)<BR>if i &#062; 40 then <BR>__iStart = i - 40<BR>__strOut = "..."<BR>else<BR>__iStart = 1<BR>end if<BR>response.write strOut & replace(mid(objRS("memo"), i, 100), strWord, "&#060;b&#062;" & strWord & "&#060;/b&#062;") & "..."<BR>

Posting Permissions

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