Closed (fixed)
Project:
Computed Field
Version:
4.7.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
24 Dec 2006 at 15:41 UTC
Updated:
1 Sep 2008 at 18:15 UTC
Hi
I am not programmer and I think could be useful have a example using "IF" ""ELSE"
For example:
IF field_fruit = orange So field_fruit = 5
Ifelse field_fruit = apple So field_fruit = 7
If field_salad = tomato So field_salad = 6
Ifelse field_salad = potate So field_salad = 9
Result = field_fruit + field_salad
Cheers
Comments
Comment #1
nisguy commentedYes, me too!
I was trying to create a quiz and wanted to calculate grades and display results. An example that would help me would be to test if question_1[0]['value'] = 'some_correct_value', then print 'correct', else print 'incorrect'.
Comment #2
oadaeh commentedHow about this:
I have several CCK fields that describe various phone numbers, including a generic one labeled 'Other'. I also have a text field labeled 'Other phone type', which is a text field describing what the 'Other' field is (cell. phone, pager, mother-in-law, etc.). I have a view created in which I display the phone number like this: "123-4567 (other cell. phone)". The other type field isn't always filled in, however, and I don't want the display to look like "123-4567 ()", so I check it before I set the computed field and either put the type in with parenthesis or not at all, depending on the value.
Comment #3
Rosamunda commentedSorry for my silly comment, but where should I put this code? I´m trying to use this module for a couple of days now, and still trying to use it... unsuccessfully. (well, I must admit that as I´m not a programmer its a bit harder for me to get it...)
Comment #4
Moonshine commentedClosing out old Drupal 4.7 issues, as it is no longer a supported release.