January 12, 20205 yr I have a layout calculation that looks like: Round(If($$NoGPABump = 1;Classes::GPANoBump; Classes::GPABumped);2) In most instances, this rounds the appropriate value to 2 decimals and displays those two digits. But on occasion, it displays only one decimal as in this one: . Instead I want to see 4.20. If I round to, say, 4 decimals, it works properly: . Rounding to 3 digits gives 4.199. How do I get the trailing zero to show up? This seems to be consistent for all data that rounds to a last digit of zero. Is this a bug? Is there a workaround? Thanks,
January 12, 20205 yr Set the layout object to display as a numeric with 2 decimals (using the inspector).
January 12, 20205 yr Author Thank you Kaizentu. In this case the layout object is a button bar with a conditionally calculated title and there is no option to set the format of the object. I've gotten used to using that technique a lot to display conditional or calculated text. It's a great way to avoid creating another calculated field but seems to have this limitation. I went back to the workaround for this - two instances of the field superimposed, using "Hide object when" to display the relevant one. Any other option? Thanks
January 12, 20205 yr You can do your own formatting within the calculation, for example: Let ( [ n = If ( $$NoGPABump = 1 ; Classes::GPANoBump ; Classes::GPABumped ) ; r = Round ( n ; 2 ) ] ; Int ( r ) & SerialIncrement ( ".00" ; 100 * Mod ( r ; 1 ) ) ) Note that this assumes the number is not negative - otherwise the calculation needs to be a bit more complex.
January 15, 20205 yr Author Wow, that's cool. I never considered brute force calculating the formatted text. I suppose I could write a custom function to support formatting rounded to a given number of decimals. I guess I'm spoiled and used to platforms that have that kind of functionality built in. For this one, however, I think the easiest solution is to use the field formatting with conditional visibility rather than the calculation. Not too bad! Thanks for the help
Create an account or sign in to comment