Submitted by reesd on 2011/08/31 20:58
 
It would be nice if we could use equations for computing individual field formatting (or at least color) rather than using the grid widget's conditional formats. Basically like what we can do at the item level now.
 
So instead of putting this in an field properties conditional formats
-1:PriInt=1:ForeColor=DarkRed
-1:PriInt=2:ForeColor=OrangeRed
-1:PriInt=3:ForeColor=DarkGreen
-1:PriInt=4:ForeColor=DarkBlue
 
I would put this in a new ForeColor Equation in the in the field properties
=ComputeColor( [Item], [Priority])
 
 Essentially you would be a row equation for each formatting option. This would allow us all the power of equations and functions and also make conditional formatting logic the same as the conditional formatting logic (only one set to describe).
 
If folks still wanted to do it inline, we could write a simple function that wraps a Case statement. Something like this:
=DoCase(PrinInt=1, "DarkRed", PriInt=2, "OrangeRed", PriInt=3, "DarkGreen")
 
 d
 

Comments

Hi reesd,
I think this would make it much harder for non-coders to grasp.
And except for the fact that it looks more concise in the field properties conditional formatting section, what is the real advantage of that method ? You still have to define that function somewhere, with its various cases etc..
 
--------------------------------------------------------------------------------
Windows XP Home Edition, Service pack 2
Dell Vostro 1500, Ram:3gb, CPU:Core2Duo T7500 2.2ghz

reesd

2011/09/15 12:02

In reply to by Armando

The main advantages would be ability to dynamically compute color/formatting based on values, which is something you can't do now. It also would mean we have one equation/script language for everything, which is always good.
 
I can see some of your concern though, but I think we could make it just as simple. Maybe something like this?
 
IF(PriInt=1, ForeColor="DarkRed")
IF(PriInt=2, ForeColor="OrangeRed")
IF(PriInt=3, ForeColor="DarkGreen")
IF(PriInt=4, ForeColor="DarkBlue
")
 
which would also allow
ForeColor = ComputeColor( [Item], [Priority])
 
So basically he could expose a set of variables like "ForeColor" that you can set in the formatting script. He then applies the resulting values.
 
d

Armando

2011/09/15 14:49

In reply to by reesd

Of course, coherence is good, and I see the point.
 
[quote=reesd]
The main advantages would be ability to dynamically compute color/formatting based on values[/quote]
 
But can't you do that already ?
(taken from notepad : right click on conditional formatting headers, select "edit in notepad")
 
-1:=1:backcolor=&hE5E5FF
-1:=2:backcolor=&hC3C3FF
-1:=3:backcolor=&h9696FF
-1:=4:backcolor=&h7171FF
-1:=5:backcolor=&h3C3CFF
-1:=6:backcolor=&h1E1EFF
-1:=7:backcolor=&h0B0BFF
-1:=8:backcolor=&h0000ED
-1:=9:backcolor=&h0606D2
-1:=10:backcolor=&h0000BD
0:=0:backcolor=&hF4FDFF
 
So here, I have a value (=1, =2...), which is computed by a function in my user code, and a corresponding Color.
 
You could also have the same thing, but taking the results from one field (or even a combination of fields) to determine the Color of another one (which I do a lot) :
 
-1:Urgency=10:backcolor=&hE5E5FF
-1:Urgency=20:backcolor=&hC3C3FF
-1:Urgency=30:backcolor=&h9696FF
-1:Urgency=40:backcolor=&h7171FF
-1:Urgency=50:backcolor=&h3C3CFF
-1:Urgency=60:backcolor=&h1E1EFF
-1:Urgency=70:backcolor=&h0B0BFF
-1:Urgency=80:backcolor=&h0000ED
-1:Urgency=90:backcolor=&h0606D2
-1:Urgency=100:backcolor=&h0000BD
 
And the urgency value is determined by a function.
 
--------------------------------------------------------------------------------
Windows XP Home Edition, Service pack 2
Dell Vostro 1500, Ram:3gb, CPU:Core2Duo T7500 2.2ghz

reesd

2011/09/16 08:58

In reply to by Armando

Yes, that would work, but you have to use that long list of mappings in the conditional formats. Still, its a workaround for now.
 
Thanks,
d

Armando

2011/09/16 15:04

In reply to by reesd

Yes, it's probably not as "sexy" as a being able to manage all of these in the User/Database Code section, but it's still quite manageable if you edit your conditional formats in a text editor.
 
(Doing it in the UI is maddening so I always use the option to open the file in the text editor. What's good is that configurations can be imported, etc. So it has several advantages.)
 
--------------------------------------------------------------------------------
Windows XP Home Edition, Service pack 2
Dell Vostro 1500, Ram:3gb, CPU:Core2Duo T7500 2.2ghz