Loading...
 
Features / Usability

Features / Usability


tracker list - decimal places

posts: 210 Ukraine

Using TrackerList in wiki page for fields that are mathematical calculations, is there any way to limit the number of places after the decimal (i.e. '2.13' vs. '2.1384639473')? Or add to the ones at the bottom (TrackerList Advanced option, 'compute'), so they have one or two (i.e. '2.13' vs. '2')

Here is a screenshot (in the Image File Gallery > Misc., called 'decimal places' if not viewable):
Decimal Places

posts: 1560 Germany

Hi mikeua,

I can not help you in person, as I am not familiar with computed fields (yet).

But I find this kind of an interesting and important issue, so I will send a link to this thread to two developers (coders) who might be interested in the issue and who might know either an answer or someone who knows or have an idea to add a few lines of code.

No promise at all, but I ask them to have a look if they any have a few minutes of time.

Best regards anyway,
Torsten


posts: 210 Ukraine

found a partial answer a long time ago, forgot to post the solution -

it depends on where you want the rounded number:

1) if in the tracker field called 'Numeric Field', you simply add a number (i.e. 3) to the box 'Decimal Places' in the tab 'Options for Numeric Field'.

2) if in the Mathematical Calculation field, than you add a set of parenthesis around your formula with the amount of places you want to round to, for example if I wanted to round to 4 decimal places and your formula was "(mul f_1080 f_1081)" than it would look like this:
(round(mul f_1080 f_1081)4)

this is explained on the Advanced Rating page in the documentation

Currently, adding or reducing the number of decimal places at the bottom of a TrackerList column ('compute') is not possible, hopefully this will be developed over time.


posts: 3638 United States

Another alternative is to use a Pretty Tracker instead of the default table from the TrackerList. Then, you could use regular Smarty variable modifiers to display the number of decimal places for a specific tracker field. For example:

{$f_XXX|string_format:"%.2f"}


HTH,

- Rick | My Tiki Blog | My Tiki UserPage

Why be a dummy? Get smarty! TikiForSmarties.com
Tiki for Smarties, your source for the best (and only) Tiki books, guides, and tutorials.