Get ready for BLACK FRIDAY shopping starting in

Forums

ASP

This topic is locked

Diplaying Partial Results from a Search

Posted 16 Jul 2004 19:19:03
1
has voted
16 Jul 2004 19:19:03 Lewis Killorn posted:
I have built a search results page and want to display partial data from a database field.

e.g. If the database field has a paragraph of text which is lets around 1000 characters long"

How do i display an extract or part of the text such as the first 100 characters or even better an extract showing the term searched for in context.

Replies

Replied 16 Jul 2004 21:19:18
16 Jul 2004 21:19:18 Rene Bandsma replied:
I think you can do this by the LEN function and count the characters with the LEFT fuction. Just google to ASP, LEN
Replied 17 Jul 2004 12:36:06
17 Jul 2004 12:36:06 Lewis Killorn replied:
Had a look at that but cannot figure out the syntax!!
Anyone know any examples i can look at?
Replied 18 Jul 2004 01:39:17
18 Jul 2004 01:39:17 Dave Thomas replied:
use the LEFT function. and a value for the amount of characters, so...

<pre id=code><font face=courier size=2 id=code>
&lt;%= (rsBlah.Fields.Item("articleField".value) %&gt;
</font id=code></pre id=code>

would become

<pre id=code><font face=courier size=2 id=code>
&lt;%= Left(rsBlah.Fields.Item("articleField".Value, 100)%&gt;...
</font id=code></pre id=code>

notice the 3 trailing dots outside of the asp delimiter, this will give the text a blah blah... finish

there is also ways to do this with complete words so you dont cut a word in half.

when you say an extract showing the search term, you mean like highlighting the keyword?

Regards,
Dave

[DWMX 2004]|[FlashMX 2004 Pro]|[SQL]|[Access2000]|[ASP/VBScript]|[XP-Pro]
Replied 19 Jul 2004 11:00:48
19 Jul 2004 11:00:48 Lewis Killorn replied:
Nice one Dave!!
Do you know how I can do this with complete words so you dont cut a word in half??

Thanks for your help.


<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
use the LEFT function. and a value for the amount of characters, so...

<pre id=code><font face=courier size=2 id=code>
&lt;%= (rsBlah.Fields.Item("articleField".value) %&gt;
</font id=code></pre id=code>

would become

<pre id=code><font face=courier size=2 id=code>
&lt;%= Left(rsBlah.Fields.Item("articleField".Value, 100)%&gt;...
</font id=code></pre id=code>

notice the 3 trailing dots outside of the asp delimiter, this will give the text a blah blah... finish

there is also ways to do this with complete words so you dont cut a word in half.

when you say an extract showing the search term, you mean like highlighting the keyword?

Regards,
Dave

[DWMX 2004]|[FlashMX 2004 Pro]|[SQL]|[Access2000]|[ASP/VBScript]|[XP-Pro]

<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Replied 19 Jul 2004 13:36:58
19 Jul 2004 13:36:58 Lee Diggins replied:
Hi LewisK

This is quite a good article, with a function at the end to use.

64.233.161.104/search?q=cache:u4E9fNr6YRMJ:www.codeproject.com/asp/textpreview.asp+vbscript+example+left+whole+words&hl=en

Let us know if you get stuck


Digga

Sharing Knowledge Saves Valuable Time!!!
Replied 19 Jul 2004 14:00:12
19 Jul 2004 14:00:12 Lewis Killorn replied:
Hi Digga
Could not connect to the URL you suggested can you post it again or mail it to me at

Cheers for the help.

Lewis[
quote]
Hi LewisK

This is quite a good article, with a function at the end to use.

64.233.161.104/search?q=cache:u4E9fNr6YRMJ:www.codeproject.com/asp/textpreview.asp+vbscript+example+left+whole+words&hl=en

Let us know if you get stuck


Digga

Sharing Knowledge Saves Valuable Time!!!
Replied 19 Jul 2004 14:00:19
19 Jul 2004 14:00:19 Lewis Killorn replied:
Hi Digga
Could not connect to the URL you suggested can you post it again or mail it to me at

Cheers for the help.

Lewis[
quote]
Hi LewisK

This is quite a good article, with a function at the end to use.

64.233.161.104/search?q=cache:u4E9fNr6YRMJ:www.codeproject.com/asp/textpreview.asp+vbscript+example+left+whole+words&hl=en

Let us know if you get stuck


Digga

Sharing Knowledge Saves Valuable Time!!!
Replied 20 Jul 2004 17:29:15
20 Jul 2004 17:29:15 Lee Diggins replied:
The site is a bit on the slow side, try this:

www.codeproject.com/asp/textpreview.asp

Digga

Sharing Knowledge Saves Valuable Time!!!

Reply to this topic