Skip site navigation (1) Skip section navigation (2)

Re: Colors/bold chars in a select?

From: <operationsengineer1(at)yahoo(dot)com>
To: nasr(dot)laili(at)tin(dot)it, pgsql-novice(at)postgresql(dot)org
Subject: Re: Colors/bold chars in a select?
Date: 2006-04-13 23:13:37
Message-ID: 20060413231337.85952.qmail@web33310.mail.mud.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-novice
> * operationsengineer1(at)yahoo(dot)com
> <operationsengineer1(at)yahoo(dot)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 

In response to

Responses

pgsql-novice by date

Next:From: RelaxinDate: 2006-04-14 06:37:49
Subject: Re: PostgreSQL a slow DB?
Previous:From: Bruce MomjianDate: 2006-04-13 22:29:22
Subject: Re: The COPY command and csv files

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group