Apply Color from Database to Each Row in Table

Hello Everyone,

What is the best/easiest way to use a color from the database for a each row in a table? I am saving the color in the database as “color(int, int, int, int)”, but I don’t know how to map that color to the entire row in the table.

My table is something like: ID(hidden), value, value, value, color(hidden)
Thanks in advance.


I think the only way you’re going to approximate this is to use HTML to color the foreground or background of the values in the SELECT statement, like:

SELECT id, CONCAT('<html><span style="color:rgb(', color, ')">',value AS value1, ... etc

Not exactly what you were going for though, I don’t think…

That works, but you’re right, it’s not what I am looking for. I would like to color the entire cell background in the given color.

Is there no other way to do it? :scratch:


you really need the whole RGB spectrum for these rows? its an arbitrary color scheme?

What I am trying to do is replicate a product scheduling spreadsheet one of our clients has in FPMI. In the current spreadsheet, which is manually updated, each product type corresponds to a certain color. It helps them understand the schedule better at a glance.

The schedule table looks something like the following:StartTime, Product1, Amount, Runtime [entire row green] StartTime, Product2, Amount, Runtime [entire row yellow] StartTime, Product1, Amount, Runtime [entire row green] etc...
If things won’t work out as I have designed currently, is there another way to get the desired results? Perhaps with some scripting? There’s nothng that can’t be solved with scripting…right? :slight_smile:

Thanks for the help.


That sounds like a standard mapped background color application. Translate the products into an integer “product code”, and bring that product code into the query. (You can hide the column so it isn’t displayed). Then set that column as the mapped background column, and fill in the mapping.

Ok, I think I am beginning to get somewhere. I knew FPMI would be able to do this… :smiley:

How do I go about populating the number-to-color translation table shown in the customizer with my colors pulled from the database? I tried throwing some dummy values in there but I don’t see any of the datasets updating with the given values.

Thanks for the on-going help. I really appreciate this. It makes learning a new software package -so- much easier.


You don’t. The number-to-color translation mapping in the table was invented before the revelation around here that all non-scalar settings should be encoded into datasets so that they can be dynamic.

Until this changes, you’re stuck adding the colors by hand, sorry.