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

Re: Colors/bold chars in a select?

From: Ennio-Sr <nasr(dot)laili(at)tin(dot)it>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Colors/bold chars in a select?
Date: 2006-04-14 21:27:38
Message-ID: 20060414212738.GA9638@deby.ei.hnet (view raw or flat)
Thread:
Lists: pgsql-novice
* operationsengineer1(at)yahoo(dot)com <operationsengineer1(at)yahoo(dot)com> [130406, 16:13]:
> > * operationsengineer1(at)yahoo(dot)com
> > <operationsengineer1(at)yahoo(dot)com> [130406, 13:49]:
> > > > Hi all!
> > > > This is just a peregrine thought:
>       [...] 
> > 
> > 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;
> 

I'll try to discover what a 'css span style' is ...

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

I'm using bash scripts which call psql commands (working in console, not
xterm); so, I suppose I'd have to first save the query result in a
temporary table/file and then run the loop on this table/file (no idea
for the time being on how to do that ...).
I've heard about php potential, but my learning curve would be too long;
the same applies to html and css (this is a programming tool, I suppose?).

> 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.
> 

Neither do I ;)

Thanks for your hints: with further reading I'll try to get some result
out of them.
Best regards,
	Ennio.

------
PS: I won't be able to see any mail until next Tuesday. Happy Easter to
all of you.

-- 
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo.   \\?//
 Fa' qualche cosa di cui non sei capace!"  (diceva Henry Miller) ]    (°|°)
[Why use Win$ozz (I say) if ... "even a fool can do that.              )=(
 Do something you aren't good at!" (as Henry Miller used to say) ]

In response to

Responses

pgsql-novice by date

Next:From: Martin FosterDate: 2006-04-14 21:49:33
Subject: On the subject of inheritance
Previous:From: RelaxinDate: 2006-04-14 19:00:20
Subject: Re: PostgreSQL a slow DB?

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