Submitted by David_H on 2016/12/06 13:49
I have a pop-up status field I use that consists of 3 values, open; closed; focus.
 
I would like the associated item background color to change when one of those values is selected.  It's not working and I'm probably missing something obvious as to why it's not.  Instructions please?
 
Thanks

Comments

I need some hand holding here Pierre :-).
 
Popup field with the name of status, with values of open; focus; closed.  If I set the value to closed, I want the associated item to change to the background color of moss.
 
How would I write that equation to get it to work?
 
Thanks

Pierre_Admin

2016/12/06 15:53

In reply to by David_H

Something like:
Status field auto-assign:
M:[ItemColor] = ColorFromStatus([Status])
 
Where ColorFromStatus is a script in VBEditor
 

Function ColorFromStatus(Status)   ' calculation of the itemcolor color code
  dim s
  s=ucase(Status)
  if isnull(s) or s="" then
     ColorFromStatus=""
  else
    select case s
      case "OPEN" : ColorFromStatus=""
      case "CLOSED" : ColorFromStatus="Moss"
    end select
  end if

End Function

HTH !
 
Pierre_Admin
IQ Designer
 

Pierre's solution will work fine (if you know VBScript), but, for that, conditional formatting should work great too -- and you don't need to know heavy scripting.
 
I actually usually prefer conditional formatting as performance is better than writing formatting directly in fields; it's also much more flexible.
 
- e.g. It will allow an item to have different formatting depending on the grid it's in as conditional formatting needs the field/columns to be present in the grids (but can be **hidden**) and you can play with that.
 
- By contrast, if you assign a color to the itemcolor field, it's always there, in any grid. This can of course also be good if you need some color code to be there everywhere, wherever, whenever. I use it for specific item types, but less for "states"
 
 
So, to take your request, specifically. 
 
[quote]"Popup field with the name of status, with values of open; focus; closed.  If I set the value to closed, I want the associated item to change to the background color of moss."[/quote]
 
In your **item** field just write (providing the name of your field is "Status", and that the value is exactly "closed") in the conditionnal formatting area
 
 
[Status] = "closed" : backcolor=&hB1DABE
 
 
This is how if looks in the field management dialog:
 
 
 
Simple and efficient!
 
 
 
-
IQ geek
Windows 8.1
CPU: Intel i5 2.6ghz

Pierre_Admin

2016/12/07 11:55

In reply to by Armando

So true...
 
Armnando, you're the king of conditional formatting !
 
To be on the safe side, I'd upper case the whole thing to ensure it is not case sensitive:
upper([Status]) = "CLOSED"
 
 
Pierre_Admin
IQ Designer
 

Thank you both!  For this I went with Armando's method, conditional formatting was how I was first trying to do it.  Here is how I got it to work.  I could be wrong but I believe "closed" is case sensitive, and has to be entered exactly as the value on the field is entered.
 
[Status]="Closed"
backcolor=&hB1DABE
 
What I especially like is it applies to every item in the database.  I was only expecting it to apply to items as they are marked closed.
 
Now for the simplest question of the day - where do I find the values for a color. i.e. green = "&hB1DABE"?  It's not an RGB or hex value, so perhaps the better question is what is the term for those values?
 
Thanks
 
 

Pierre_Admin

2016/12/07 14:29

In reply to by David_H

>where do I find the values for a color
 
You can apply the color to an item and look at the Property pane for the corresponding value
 
Pierre_Admin
IQ Designer
 

Tom

2016/12/07 16:04

In reply to by Pierre_Admin

[quote=Pierre_Admin]
>where do I find the values for a color
 
You can apply the color to an item and look at the Property pane for the corresponding value[/quote]
(havent used it in a while but should still work)
 
PS there were a bunch of colours/colors displayed somewhere in the forum with related values, those I couldn't find (maybe it was on donationcoder...)
 

Armando

2016/12/07 22:39

In reply to by David_H

[quote=David_H]
 
Now for the simplest question of the day - where do I find the values for a color. i.e. green = "&hB1DABE"?  It's not an RGB or hex value, so perhaps the better question is what is the term for those values?
 
[/quote]
 
Maybe it should be added to he help "file". I just use a little freeware that gives me the VB Hex (that's the format used there) code for any color.
 
 
-
IQ geek
Windows 8.1
CPU: Intel i5 2.6ghz

The only thing I see listed in the property pane is the color, i.e. "green".  Not the values for the color.

Pierre_Admin

2016/12/07 14:49

In reply to by David_H

OK, the "named" colors are defined in Tool > Options > 2.1.4
 
Pierre_Admin
IQ Designer
 

Thank Tom!  I was going to jokingly complain to Pierre asking why we only have 10 colors....but with your spreadsheet it looks like I have plenty!

Pierre_Admin

2016/12/07 19:44

In reply to by David_H

On "good" days, I can remember 10 things, that is the reason for the 10 named colors...
The "real" and "initial" purpose of named colors was to be able to bulk change the appearance of grids... By changing the named color definition, all colors change, otherwise, using actual color numbers (numeric or hex) is IMHO best.
 
Pierre_Admin
IQ Designer
 

Armando or Pierre,
 
Is there a simple way, using the conditional formatting method I'm using here, to get the color to change across the entire row (not just the Item)?
 
Thanks

Armando

2016/12/26 18:48

In reply to by David_H

[quote=David_H]
Armando or Pierre,
 
Is there a simple way, using the conditional formatting method I'm using here, to get the color to change across the entire row (not just the Item)?
 
Thanks
[/quote]
 
Hi David,
I  don't think so, as conditional formatting functions on a field basis. But maybe is there a way (undocumented ) I don't know.
That said, coloring the whole row can be achieved with the itemColor field, using the strategy Pierre explained earlier.
 
-
IQ geek
Windows 8.1
CPU: Intel i5 2.6ghz