I'm have a bunch of ENUM columns set in a retool database. I am able to set the Tag colors in that database, but when bringing these into the table component, the colors are set randomly.
If I turn automatically assign tag colors to unticked, they just turn grey, but it's not clear where I should then set the tag colors again?
In addition.. i'm pulling the mapped option list using the below query. is it possible to pull the colors set in the retool database using this query?
SELECT
enum.enumsortorder,
type.typname,
enum.enumlabel AS value
FROM pg_enum AS enum
JOIN pg_type AS type
ON (type.oid = enum.enumtypid)
WHERE type.typname like 'producer%'
GROUP BY enum.enumsortorder,
enum.enumlabel,
type.typname
ORDER BY enumsortorder
Here are a couple of posts that can guide you on how to set up your tag colors. You are using an option list, not sure if mapped or manual, but that's where you can define the color for each tag:
Thanks for this! I'm using a mapped option. is there a way to pull the color that is defined in the retool database enum list using an additional elements in the enum query i have already? Ideally i don't want to transform and do this manually, as any items added to the enum list would need to be updated in every transformer i use as well..
Not sure I completely understand your data structure, but any value you get in your query (which you then use as data source for your mapped options) can be referred to by using item, e.g. item.typname
Thank you. To clarify, i'm using the built in Retool Database, where its possible to set colors to ENUM list options when defining an ENUM column in a table. Ideally i would want to pull those preset colors through when i query for the ENUM options, but i'm not sure how to go about doing that, and cannot find any documentation about it.
I also can't seem to figure out how to grab the color which corresponds to the enum option.
Let me double check with our backend engineering team to see if they have can help!
How many colors are you working with in total? A temporary workaround in the short term would be to use a Variable in the app where the key is the ENUM option and the value would be hard coded names of the colors. Thus you could grab the enum options and then style the frontend component/table cell to match the color value returned when keying in with the item.enumOption as Miguel mentioned
Just got word back from our engineering team, we currently have an open ticket for a feature request to make these colors accessible
I just tagged this thread into that ticket to adde more weight to it, and if there are any updates I can relay them to this thread.
If you are self hosting Retool, it is possible to access this data directly from the underlying Postgres DB that is holding the ENUMs and their colors. In this case, you would need to query grid_field."enumOptions" to get the value -> color mapping.
Thanks for the response. I'm using cloud hosted, so the final option wouldn't work for me. It would be great if those colour options were exposed in the future! The hard coding option worked for me, but its messy when options need to be added in the future.
From what I can gather, when scaling up an app or project to be production level for large numbers of users it is best to move from Retool DB to a privately and separately hosted Postgres DB. And in this case other data such as enum colors could be stored and accessed.