From: Kevin on
I have a table created in MS SQLExpress 2005 using the following
statement:

create table Fuel (PurchaseID SMALLINT identity primary key,
ClaimNo SMALLINT, PurDate DATETIME NOT NULL DEFAULT (getdate()),
Station VARCHAR(50) NOT NULL, Litres NUMERIC(6,2), Price NUMERIC(6,2),"
+ ;
FuelType VARCHAR(20), State VARCHAR(50), Notes VARCHAR(150),
Cost as (Price /100) * Litres)

The computed Cost column shows up with 8 decimals. I have not yet found
a way of specifying the number of decimal places but haven't yet found
one.

In a bBrowser I use an ADOServer to display the data. Using a FieldSpec
I can control the dsisplay of the Cost column and show only two decimal
places.

I have have three color conditions setup using the code below:

oColorCond := bColorCondition{"upper(Server:State) = 'SUBMITTED'",
self:Server, , Brush{Color{0,192,0}}}
oBrw:ColorCondition:Add( oColorCond )

oColorCond := bColorCondition{"upper(Server:State) = 'RECEIVED'",
self:Server, , Brush{Color{192,192,192}}}
oBrw:ColorCondition:Add( oColorCond )

oColorCond := bColorCondition{"Server:Litres > 0.00", self:Server,
Color{COLORBLUE}}
oBrw:ColorCondition:Add( oColorCond )

Thr first two conditions work as expected but the third one doesn't. I
had alsxo tried with "Empty(Server:State)" but it also failed. Can
anyone tell me why?

The last line of the method these are in is a browser refresh.

Thanks in advance.

Kevin

From: Stephen Quinn on
Kevin

> oColorCond := bColorCondition{"upper(Server:State) = 'SUBMITTED'",
> self:Server, , Brush{Color{0,192,0}}}
>
> oColorCond := bColorCondition{"upper(Server:State) = 'RECEIVED'",
> self:Server, , Brush{Color{192,192,192}}}
>
> oColorCond := bColorCondition{"Server:Litres > 0.00", self:Server,
> Color{COLORBLUE}}

Count your commas in the 3rd condition<g>

CYA
Steve


From: Stephen Quinn on
Kevin

Scratch that - I just realised that your changing the Foreground on that
condition.

If either of the 2 previous conditions return TRUE then the 3rd won't get
called at all (unkess they're on a different column.

Try
oColorCond := bColorCondition{"upper(Server:State) = 'SUBMITTED' .AND.
Server:Litres > 0.00",
self:Server, Color{COLORBLUE}, Brush{Color{0,192,0}}}

oColorCond := bColorCondition{"upper(Server:State) = 'RECEIVED' .AND.
Server:Litres > 0.00",
self:Server, Color{COLORBLUE}, Brush{Color{192,192,192}}}

oColorCond := bColorCondition{"upper(Server:State) = 'SUBMITTED'",
self:Server, , Brush{Color{0,192,0}}}

oColorCond := bColorCondition{"upper(Server:State) = 'RECEIVED'",
self:Server, , Brush{Color{192,192,192}}}

ie use 4 conditions

CYA
Steve


From: Kevin on
Stephen,

Thanks for your reply and it explains somewhat. The comment about "also
tried" was actually meant to be a separate condition and not checking
the Litres as well. This would line up with comment about either of the
previous two conditions returning TRUE. I had not realised this
previously and I have not found it in the help file.

If you look at my original post you will see that the third condition is
on a different column, and it does not work. Changing the third
condition to first, it works and the other two don't. From what you are
saying it should work but doesn't.

Can anyone give any clarity on what way the conditions work or why mine
won't?

Thanks.

Kevin


"Stephen Quinn" <stevejqNO(a)bigpondSPAM.net.au> wrote in message
news:msgNn.506$Ls1.230(a)news-server.bigpond.net.au:

> Kevin
>
> Scratch that - I just realised that your changing the Foreground on that
> condition.
>
> If either of the 2 previous conditions return TRUE then the 3rd won't get
> called at all (unkess they're on a different column.
>
> Try
> oColorCond := bColorCondition{"upper(Server:State) = 'SUBMITTED' .AND.
> Server:Litres > 0.00",
> self:Server, Color{COLORBLUE}, Brush{Color{0,192,0}}}
>
> oColorCond := bColorCondition{"upper(Server:State) = 'RECEIVED' .AND.
> Server:Litres > 0.00",
> self:Server, Color{COLORBLUE}, Brush{Color{192,192,192}}}
>
> oColorCond := bColorCondition{"upper(Server:State) = 'SUBMITTED'",
> self:Server, , Brush{Color{0,192,0}}}
>
> oColorCond := bColorCondition{"upper(Server:State) = 'RECEIVED'",
> self:Server, , Brush{Color{192,192,192}}}
>
> ie use 4 conditions
>
> CYA
> Steve

From: Stephen Quinn on
Kevin

> If you look at my original post you will see that the third condition is
> on a different column, and it does not work. Changing the third condition
> to first, it works and the other two don't. From what you are saying it
> should work but doesn't.
Nope - your ADDing it to the BROWSER
- oBrw:ColorCondition:Add( oColorCond )

When adding conditions to the browser they are evaulated in the order added,
when one evaluates to TRUE the evaulation sequence is ended.

I can see what the problem is now with the extra info you provided.
What I showed was the foreground/background colour change for the ROW (4
conditions)

If you want to affect the forground of a single column then you apply the
condition to the COLUMN not the BROWSER.
Eg
oCol := oBrw:GetOpenColumn( #LITRES )

oColorCond := bColorCondition{"Server:Litres > 0.00", self:Server,
Color{COLORBLUE}}

oCol:ColorCondition:Add( oColorCond )

CYA
Steve