Closed (won't fix)
Project:
Views Calc
Version:
6.x-1.3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Sep 2009 at 08:32 UTC
Updated:
15 Feb 2014 at 12:27 UTC
Jump to comment: Most recent
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
Comment #1
afox commentedNot 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.
Comment #2
dogboy72 commentedAdding 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"
Comment #3
PeteS commentedSeriously, 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
Comment #4
karens commentedThe D6 version is no longer supported.