CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeCharge.Discussion

 create a example field?

Print topic Send  topic

Author Message
markus
Posted: 05/24/2001, 10:43 PM

Hi all,

My question is this:

I am currently building an online articles system for a client. I wan to be
able to take the first few sentences of the articles content as an example of
the article and then have the reader click the title to read more.

I know i can use the following SQL statement to create a new field of the
size i require:

select left(content,300) from articles;

which will give me a new filed of 300 characters long to use.

The pronlem with this is that most of the time it leaves unfinshed words at
the end of the field, like "whe" instead of "whether", because the 300th
character has been reached.

is there a way to use some kind of statement to limit this to entire words?

help me obi-wan etc etc etc

thanks

markus

P.S Great Product, we are now using it with Sun Chili!ASP exclusively.

==============================================================
Posted with Hogwasher. Mac first, Mac only:
http://www.asar.com/cgi-bin/product.pl?58/hogwasher.html
==============================================================
Morris Nelson
Posted: 05/25/2001, 12:08 AM

Try using InStrRev(fld," ") on your result by finding the last space then
use Mid to shorten it to that length.

"markus" <mbuddy@removeme.mac.com> wrote in message
news:01HW.B7342ECD000405B40F22FFC0@news.codecharge.com...
> Hi all,
>
> My question is this:
>
> I am currently building an online articles system for a client. I wan to
be
> able to take the first few sentences of the articles content as an example
of
> the article and then have the reader click the title to read more.
>
> I know i can use the following SQL statement to create a new field of the
> size i require:
>
> select left(content,300) from articles;
>
> which will give me a new filed of 300 characters long to use.
>
> The pronlem with this is that most of the time it leaves unfinshed words
at
> the end of the field, like "whe" instead of "whether", because the 300th
> character has been reached.
>
> is there a way to use some kind of statement to limit this to entire
words?
>
> help me obi-wan etc etc etc
>
> thanks
>
> markus
>
> P.S Great Product, we are now using it with Sun Chili!ASP exclusively.
>
> ==============================================================
> Posted with Hogwasher. Mac first, Mac only:
> http://www.asar.com/cgi-bin/product.pl?58/hogwasher.html
> ==============================================================
>

markus
Posted: 05/25/2001, 12:52 AM

Where and how? In codecharge events or in SQL.

Sorry i need more info.

On Fri, 25 May 2001 17:11:22 +1000, Morris Nelson wrote
(in message <9el0d0$g58$1@mail.tankhill.com>):

> Try using InStrRev(fld," ") on your result by finding the last space then
> use Mid to shorten it to that length.



==============================================================
Posted with Hogwasher. Mac first, Mac only:
http://www.asar.com/cgi-bin/product.pl?58/hogwasher.html
==============================================================
CodeCharge
Posted: 05/25/2001, 3:44 PM

You can do such operations in BeforeShow Event. For example
fldcontent = left(fldcontent,300)
this depends on the language, so it may be:
$fldcontent = left($fldcontent,300)

Please replace "left($fldcontent,300)" with the set of functions that are
more suited in your case.



"markus" <mbuddy@removeme.mac.com> wrote in message
news:01HW.B7344CFA000B1CC70F229F80@news.codecharge.com...
> Where and how? In codecharge events or in SQL.
>
> Sorry i need more info.
>
> On Fri, 25 May 2001 17:11:22 +1000, Morris Nelson wrote
> (in message <9el0d0$g58$1@mail.tankhill.com>):
>
> > Try using InStrRev(fld," ") on your result by finding the last space
then
> > use Mid to shorten it to that length.
>
>
>
> ==============================================================
> Posted with Hogwasher. Mac first, Mac only:
> http://www.asar.com/cgi-bin/product.pl?58/hogwasher.html
> ==============================================================
>

markus
Posted: 05/29/2001, 9:21 PM

Can I get a bit more info on how to do this? is this done in SQl or
Codecharge? Sorry, I am not an SQL guru...

markus

On Fri, 25 May 2001 17:11:22 +1000, Morris Nelson wrote
(in message <9el0d0$g58$1@mail.tankhill.com>):

> Try using InStrRev(fld," ") on your result by finding the last space then
> use Mid to shorten it to that length.
>



================================================================
Hogwasher: You don't have to sacrifice friendliness for power
http://www.asar.com/cgi-bin/product.pl?58/hogwasher.html
================================================================
Morris Nelson
Posted: 05/30/2001, 9:11 AM

It's something you'd put in cc in a "before show"

If I were writing plain old ASP, I would do the following:
1- assume you received 300 or less characters from sql. You figured that out
already.
2- find the last space in the string using instrrev (instr would find the
first)
location = InStrRev(fromsql300, " ")
note: If you want to back to the end of the last sentence, change " " to "."
3 get the substring of
fldlittlefield=Mid(fromsql300,1,location-1) the "-1" may not be necessary.

cc people can add their 2cents if it needs to be coded more specifiically in
cc
good luck
mn

"markus" <mbuddy@removeme.mac.com> wrote in message
news:01HW.B73AB307000485110418EA10@news.codecharge.com...
> Can I get a bit more info on how to do this? is this done in SQl or
> Codecharge? Sorry, I am not an SQL guru...
>
> markus
>
> On Fri, 25 May 2001 17:11:22 +1000, Morris Nelson wrote
> (in message <9el0d0$g58$1@mail.tankhill.com>):
>
> > Try using InStrRev(fld," ") on your result by finding the last space
then
> > use Mid to shorten it to that length.
> >
>
>
>
> ================================================================
> Hogwasher: You don't have to sacrifice friendliness for power
> http://www.asar.com/cgi-bin/product.pl?58/hogwasher.html
> ================================================================
>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.