dosubot[bot] commented on issue #30391:
URL: https://github.com/apache/superset/issues/30391#issuecomment-2374768079

   <!-- Greeting -->
   Hey there, @kraftaa! I'm here to help you with any bugs, questions, or 
contributions you have for Superset. Let's work together to solve the issue 
you're facing.
   
   <!-- Answer -->
   To resolve the issue of `False/True` vs `false/true` in the `final_value` 
column when filtering data in Superset, you can use the 
`getDataRecordFormatter` function to ensure consistent boolean string 
formatting. This function converts various representations of boolean values to 
a standardized format (`TRUE_STRING` or `FALSE_STRING`).
   
   Here is an example of how you can use `getDataRecordFormatter` to handle 
this:
   
   ```ts
   import { getDataRecordFormatter, GenericDataType } from 'src/filters/utils';
   import { TRUE_STRING, FALSE_STRING } from 'src/utils/common';
   
   const formatter = getDataRecordFormatter();
   
   // Example usage:
   const formattedValue1 = formatter('true', GenericDataType.Boolean); // 
returns TRUE_STRING
   const formattedValue2 = formatter('False', GenericDataType.Boolean); // 
returns FALSE_STRING
   const formattedValue3 = formatter(true, GenericDataType.Boolean); // returns 
TRUE_STRING
   const formattedValue4 = formatter(false, GenericDataType.Boolean); // 
returns FALSE_STRING
   
   console.log(formattedValue1); // "true"
   console.log(formattedValue2); // "false"
   console.log(formattedValue3); // "true"
   console.log(formattedValue4); // "false"
   ```
   
   By using this formatter, you can ensure that all boolean values in the 
`final_value` column are consistently formatted, which will help in filtering 
the data correctly. The `getDataRecordFormatter` function handles various data 
types and ensures that boolean values are converted to `TRUE_STRING` or 
`FALSE_STRING` based on their truthiness 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/src/filters/utils.ts)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/src/filters/utils.test.ts)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to