Hi, is there a specific way to insert a number value with decimal places in an calculation?


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.


afox’s picture

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.

dogboy72’s picture

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"

PeteS’s picture

Seriously, what is going on in views_calc_fields_form_validate()? Why am I allowed to use "1000" in my calculation but not "10000" (which gives me "The values 00 .. are not allowed")? This function is mind-bogglingly confusing. Why are all of those slashes in there? 0.o

KarenS’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

The D6 version is no longer supported.