Key-Value component formatting null percent columns as 0.00%

Hi everyone,

I am new to Retool and I am using the Key-Value component to show information selected from a table.

All values are null, and if I set the column type format to 'Auto' the component shows the values as 'null' which is correct.

But when I try to set the column type format of some columns to 'percent', it shows the value as 0.00%, which is incorrect.

Is there any way to fix this and show null percent columns as null?

image

Hi, welcome aboard the Retool train

I don't think the percent formatter handles nulls properly and even booleans get changed to 0% or 100% so your best bet might be to make it a string and format the data yourself

eg something like this in the mapped value field for that column:

{{ self ? self.toFixed(2)+'%' : "" }}

2 Likes

Thank you very much for the hint, it fixed my issue. The formatting I am using is:

{{ self[0] === null ? null : (self * 100) + "%" }}
1 Like