Greetings,
We have reports that reference db columns which are essentially flags with 0/1 values in the underlying data. Their numeric values make it easy to sum-aggregate in pivot which is what we need. At the same time, 0 and 1 aren't friendly for average users to see when they switch to flat. We are aware of customizeCell that could be used to replace with 'No' and 'Yes' but it's not a great solution considering the field needs to be further customized to left-align textual values and, more critical, filter popup for such fields still lists 0 and 1. Ideally, there would be a mechanism to "map" values from data for a given field to whatever values to be shown in a report. Please let us know if there is a workaround?
Thank you
Hello,
Thank you for writing to us.
Flexmonster does not currently provide a built-in mechanism to map raw data values to alternative labels. The only workaround for changing filter labels is to preprocess the data to create an additional field with a textual representation matching the column with 0/1 flags. This way, it would still be possible to use numeric column values for calculations, while string values can be used to represent this data in a flat view.
If this is not an option, then at least here is how you can adjust the values alignment on the grid:
customizeCell function.if (cell.text == "1") {
cell.text = "Yes";
cell.style["text-align"] = "left";
}
formats: [
{
name: "alignLeft",
textAlign: "left",
},
],
Both of these approaches are available in this example: https://jsfiddle.net/flexmonster/hmbzn6w1/
Please let us know if our answer was helpful.
Best regards,
Maksym
Maksym, appreciate the time you took to respond. There is no way to reflect No/Yes instead of 0/1 inside the filter for "Open" field, right?
Hello Gennady,
Thank you for your reply.
While it is not possible to change member captions in filters for a single field, it is possible to achieve similar results by adding a second field, which would duplicate the field, including both 1 and 0 with their string representations ("Yes"/"No"). Flexmonster displays filter members exactly as they are provided in the data source, so adding a second field with string values will allow the filter pop-up to show them instead of numbers.
It is important to clarify that this additional field must be added before the data is loaded into Flexmonster, where the data is generated or served. You are welcome to check the JSFiddle example demonstrating this approach: https://jsfiddle.net/flexmonster/gnj4k96s/
Please let us know if this approach would work for you.
Best regards,
Maksym
Maksym, understood. Not quite what we wish would've been possible but it is what it is. Thanks for taking the time to provide detailed responses.
Hello Gennady,
Thank you for your feedback.
We understand that the provided workaround may not be exactly what you were looking for. However, if you decide to try it and have any questions, feel free to contact us.
Best regards,
Maksym