Is there a way to color code attribute values? In...
# gooddata-cloud
m
Is there a way to color code attribute values? In my example below, I'd like to color "true" as green and "false" or "(empty value)" as red:
i
Hi Michael, You can play around with metric formatting as stated in this article. Let me check internally if we can apply conditional formatting even to nonnumerical values like this.
m
Thanks, I was going down that path, but it appears that I need a numeric value to output from a metric?
m
Hi Michael, you are right that the metric formatting in general can not be used on attributes but only to values of metrics. In yoir case where you seem to have boolean values of attributes you might consider including some additional fact (i.e. with 1/0 values) into your data model to represent the values of these attributes and then use it in some metric and apply metric formatting to it. You could display it as true/false/null and you could color code that. But, itbwould still be a metric, that means to the right of all the attributes and you would not be able to slice/filter by it so you would still need to use an attribute for that.
ūüĎć 1
m
OK, if I change the SQL query to case statements so that I get 0's and 1's, I can't aggregate them (I get a 400 error from the backend). Query output:
image.png
A single one works fine though:
Model:
i
Please be aware that MAQL is bit different from the SQL. You can find some hints how to build the CASE metric properly here.
m
Hi Michael, for your error, we found this error in our internal logs:
org.postgresql.util.PSQLException: ERROR: argument of AND must be type boolean, not type bigint
so it seems that some query (either generated from your metric or within your database) contains some error in a condition. I would guess something like ... WHERE {fact} instead of WHERE {fact}=value
m
Thank you @Michal Hauzirek. Is there a way I can see our postgres errors? That would greatly help our team debug issues like this.
m
Not at the moment I am afraid (unless they are also somehow logged on the postgres end). But as far as I know the engineers are working on better propagation of these errors so in tje future you should see more useful error messages.