CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 number format / red negative

Print topic Send  topic

Author Message
knackje

Posts: 30
Posted: 03/07/2007, 1:49 AM

hi all,

i want to have a lable who displays a number in red when negative and just normal black when positive. When seatching on this forum is found the flowwing solution in topic:

http://forums.codecharge.com/posts.php?post_id=75097&s_keyword=negative+red

solution:
#.#;[Red]#.#

I copy paste it in CCS but it won't work. What do i have to change? Do i have to replace the # with something else?

tnx in advanced
View profile  Send private message
DonB
Posted: 03/07/2007, 5:20 AM

This won't work if the data type is 'text', even if the value it contains
evaluates to a number.

--
DonB

http://www.gotodon.com/ccbth


"knackje" <knackje@forum.codecharge> wrote in message
news:545ee8aa56b1c5@news.codecharge.com...
> hi all,
>
> i want to have a lable who displays a number in red when negative and just
> normal black when positive. When seatching on this forum is found the
flowwing
> solution in topic:
>
>
http://forums.codecharge.com/posts.php?post_id=75097&s_keyword=negative+red
>
> solution:
> #.#;[Red]#.#
>
> I copy paste it in CCS but it won't work. What do i have to change? Do i
have
> to replace the # with something else?
>
> tnx in advanced
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

knackje

Posts: 30
Posted: 03/08/2007, 1:38 AM

set it as an interger..but still no succes. I've changed it also from label to textbox... but still no red format when negative :(

any idea?
View profile  Send private message
Hidran
Posted: 03/08/2007, 2:59 AM

I would place a label in a span around that value and in beforeshowrow
event:
put this:
if($Container->myvalue->GetValue()<0){
$Container->mylabel->SetValue("red");
}else{
$Container->mylabel->SetValue("normal");
}

<span class="{mylabel}"> here goes your control</span>
in your css:
..red{color:red}

"knackje" <knackje@forum.codecharge> ha scritto nel messaggio
news:545ee8aa56b1c5@news.codecharge.com...
> hi all,
>
> i want to have a lable who displays a number in red when negative and just
> normal black when positive. When seatching on this forum is found the
> flowwing
> solution in topic:
>
> http://forums.codecharge.com/posts.php?post_id=75097&s_keyword=negative+red
>
> solution:
> #.#;[Red]#.#
>
> I copy paste it in CCS but it won't work. What do i have to change? Do i
> have
> to replace the # with something else?
>
> tnx in advanced
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Vlad

Posts: 3
Posted: 03/08/2007, 3:54 AM

The simpliest way is to use CCS HTML color='Red'>attributes.
For example just place color='Red'>attribute named 'Color' into TD tag like this:
<td style="COLOR: {NewRecord1:Color}">{Label1}</td>
Then place custom code into Record's Before Show event (or Before Show Row for Grid).

if ($NewRecord1->Label1->GetValue()<0) {
$NewRecord1->color='Red'>Attributes->SetValue('Color', 'Red');
}
else {
$NewRecord1->color='Red'>Attributes->SetValue('Color', 'Black');
}

See CCS Help for detailed explanation.
View profile  Send private message
wkempees
Posted: 03/08/2007, 4:42 AM

knakje,

Your original post is the way to go.
In Design click the label you want to color.
In the Properties of that label:
Data Type : float
Format : #.#;[Red]#.#
Content: HTML

This can be a Grid or a Form, whatever.
It really is tat simple as per the original post you found by DonB
http://www.dubbellul.nl/temp/display_picture.jpg









"knackje" <knackje@forum.codecharge> schreef in bericht
news:545ee8aa56b1c5@news.codecharge.com...
> hi all,
>
> i want to have a lable who displays a number in red when negative and just
> normal black when positive. When seatching on this forum is found the
> flowwing
> solution in topic:
>
> http://forums.codecharge.com/posts.php?post_id=75097&s_keyword=negative+red
>
> solution:
> #.#;[Red]#.#
>
> I copy paste it in CCS but it won't work. What do i have to change? Do i
> have
> to replace the # with something else?
>
> tnx in advanced
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

wkempees


Posts: 1679
Posted: 03/08/2007, 4:47 AM

result
http://www.dubbellul.nl/temp/display_picture2.jpg

Walter


_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
knackje

Posts: 30
Posted: 03/08/2007, 5:35 AM

tnx for helping.. will look at when i'm home.
View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 03/08/2007, 1:28 PM

knackje
Just to add my two cents..... You could also create a result set (SQL query) that outputs the value in html format. I use it all the time for my result sets.
View profile  Send private message

Add new topic Subscribe to topic   


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

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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