Posted by Parkes Design on September 8, 2009 at 8:32am
Jump to:
| Project: | Views Calc |
| Version: | 6.x-1.3 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Hi, is there a specific way to insert a number value with decimal places in an calculation?
Eg
12.6 + %node_data_field_mmheight.field_mmheight_value (I get an error message The values . in Height Calculation are not allowed.)
but if I put
12 + %node_data_field_mmheight.field_mmheight_value
It works fine. This is a bug right?
I've tested this is both 6.x 1.3 and dev versions.
Comments
#1
Not sure if it is a bug, but my solution for it is to add the decimal marker (dot or comma, depending where you're from) to the allowed functions and operators in settings.
I don't think it should be like this. The problem lies in views_calc_fields_form_validate -function where no decimals are checked on default. Should be rather easy to fix, but the pattern-arrays look rather complicated, that I'm not sure if the maintainer has a specific reason for doing it like this. But for now I'll just use the allowed operators -field.
#2
Adding the decimal in the allowed operators list did not work for me. I was able to edit the field "calc" ( in the views calc table(via phpmyadmin)) and add a decimal in my calculation. This worked but was a hassle since I could no longer use the views calc custom field ui.
I decided to use "/" and "+" to create my decimal. (i.e. a custom field to add 10% went from "%node_data_field_MYFIELD.field_MYFIELD_value * 1.1" to "%node_data_field_MYFIELD.field_MYFIELD_value/10 + %node_data_field_MYFIELD.field_MYFIELD_value"