Binding a color to a column in a dataset

I have a pipe segment that I would like to display in different colors depending upon what is currently happening. One of the datasets in the project has a column that reflects what is happening (0=nothing, 1=product transfer, 255=cip, etc.). When I try to bind to this column in the property binding screen, I can select the dataset, but I cannot further specify a column. Do I need to place a label on the screen somewhere with the status bit (and maybe make that invisible), then bind the pipe segment color to the label? Please advise.

TIA D. Lewis


You have two options here. The first one is to add a custom integer property somewhere on your window (maybe the root container), and bind that integer to the value in the dataset. Then use the standard property binding to bind directly to that integer. This is similar to your ‘invisible label’ idea, just using a custom property instead of a component. The invisible label idea would work, but adds unecessary bulk to your window.

The second option is to do the entire binding within an expression. The expression on the pipe’s color property might look like:

  toColor("Gray"), # Nothing (0)
  toColor("Green"), # Product Transfer (1)
  toColor("Yellow"), # CIP (255)
  toColor("Red") # Unknown (any other number)

Note - if you want your pipe’s color to blink, you must use option #1

Hope this helps,