Re: Colors/bold chars in a select? - Mailing list pgsql-novice

From
Subject Re: Colors/bold chars in a select?
Date
Msg-id 20060413231337.85952.qmail@web33310.mail.mud.yahoo.com
Whole thread Raw
In response to Re: Colors/bold chars in a select?  (Ennio-Sr <nasr.laili@tin.it>)
Responses Re: Colors/bold chars in a select?
List pgsql-novice
> * operationsengineer1@yahoo.com
> <operationsengineer1@yahoo.com> [130406, 13:49]:
> > > Hi all!
> > > This is just a peregrine thought:
> > > is it at all possible to print (on screen) in
> bold
> > > chars/or colour the
> > > lines of a select result that satisfy a certain
> > > condition?
> > > Regards,
> > >     Ennio
> >
> > it seems to me that the method woul dbe specific
> to
> > whatever system you are using to display the data.
> >
> > eg, if the display is html, then you could include
> > html (or some conversion that could be converted
> back
> > to avoid scripting attacks) where applicable.
> >
> > you may also be able to display the text and apply
> > regexes in order to identify the characters and
> then
> > make them bold without the html in the db.
> >
> > perhaps a stored procedure could help with this,
> but i
> > lack experience in that area as of now.
> >
> > this seems like more of an application problem
> than a
> > db problem, though.
> >
>
> Mmmm...
> I fear that your last sentence is very true and
> unluckily enough is what
> I would need to accomplish my goal; I'm already
> getting a coloured
> display of the result of my selection ...; but let
> me explain better
> what I was thinking about, as I realize it was not
> very clear:
>
> Suppose the result of my select is a table like
> this:
>
> item       ..... price_at_time_X .....
> price_at_time_Y
>
------------------------------------------------------
> aaaa                 10.1245              12.13
> bbbb                  5.14                 5.04
> cccc                  0.10                 0.12
>
> My question is:  can I get a coloured evidence that
> time_Y prices of
> items 'aaaa' and 'bbbb' are higher than at time_X so
> as to get a more
> immediate evidence of what is going on? Think about
> stock prices, as an
> example ;-)
> [I've already arranged to have separate lists of all
> items with
> higher/lower prices, but was wondering whether there
> was any other
> possibility]
>

i might be off base, but you could use your app to
check the values and then apply a css span style if
your criteria is met.

if ($y > $x){ // you'd probably be checking
// array values and running a for loop
 $y = '<span class = \'green\'> . $y . '</span>';
}

echo $y;

again, something similar tothis would work with php /
html / css.  i'm not sure what you are using.

you might be able to use a stored procedure to prepend
and append the span tags after doing the math - but i
don't know that much about stored procedures.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

pgsql-novice by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: The COPY command and csv files
Next
From: Ennio-Sr
Date:
Subject: Re: Colors/bold chars in a select?