Drupal 6.22
Views Calc seems to be installed properly -- I can use a Views Calc table to count the number of fields displayed.
I have a Content Type for a Person with a field for their year of birth, and another field for their month of birth (as text). I'd like to calculate their age. I went to admin/settings/views_calc/fields and am having trouble figuring out the syntax for a math operation. To get really simple, I was able to enter "1" (without the quotes), and my View shows 1 for each Person. When I enter "1+1" (again w/o quotes), I get an error message "The values 1 in age are not allowed." (age is what I've called this Views Calc field). I'm new to SQL, PHP, and Drupal, so I'm sure I've just got the syntax wrong, but can't find an example showing what it should be.
Comments
Comment #1
Ashford commentedMokey, on the page where you create your calculations, click the arrow to view the Tokens. The values listed are the Token code names used for your fields. You use those values for the calculations.
I do not know how to do your birthday calculation with the month and year in a separate field. Here is a simple example to help you understand how the Views_Calc works.
%node_data_field_my_fieldname.field_my_fieldname_value + %node_data_field_my_fieldname2.field_my_other_fieldname_value[my field Token] [+ plus] [my other field Token]
6 + 3 would return 9
Comment #2
karens commentedThe D6 version is no longer supported.