If you want to format a composite column (a computed column) then you must do the formatting yourself in the template. I see three ways to do what you want.
- Use column icons to show an image of stars based on the value. This would be the way to go if you want half-star images.
- Use something like the following:
Code:
program:
# the variable 'v' contains the computed rating
v = 3.5;
# verify that the value <= 5
v = cmp(v, 5, v, v, 5);
# Check if the value is a fraction
halfstar = contains(v, '\.', 'y', '');
# Make the value into an integer (floor)
v = re(v, '\..*', '');
# Get the string with the right number of stars
r = cmp(v, 0, '', '', substr('★★★★★', 0, v));
# Add the 'half' if needed
test(halfstar, strcat(r, '½'), r)
The value 3.5 produces ★★★½
- Use a custom formatter function to compute a string containing whatever you want.