Closed (fixed)
Project:
Computed Field
Version:
6.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
1 Sep 2009 at 14:51 UTC
Updated:
16 Nov 2009 at 16:30 UTC
Does anyone have a snippet for populating a computed field with a range of comma-separated numbers based on two user-entered fields - minimum and maximum?
For example, if the user enters 20 in field_value_minimum and 25 in field_value_maximum, the computed field is populated with "20,21,22,23,24,25"
Comments
Comment #1
sjf commentedI should probably explain what I'm trying to do. Essentially, I'm looking for a more user-friendly way to enter a range of numeric values than having to type each number into the field comma-separated or selecting each value from a multi-value select list. This is particularly important for large ranges.
I suppose the ideal solution would be a CCK option widget that allows the user to simply enter "20-25" in a single field, and have it stored in the database as "20,21,22,23,24,25". I don't think this is possible at the moment which is why I've turned to Computed Field.
I'm not a coder, but I ran into an article here. Obviously the code below doesn't work but could I do something like this?
The reason I need an array of numbers is so that people can perform a search in Views. For example, if someone searched all nodes that contain the number "23" in a certain field, they wouldn't find my node with the text string "20-25" in that field, but they would find it if it was in the format "20,21,22,23,24,25".
Comment #2
held69 commentedThis is exactly what i'm looking for as well.
http://drupal.org/node/616740
Would be great for entering age range in a easy way.
Suggestions on this topic very much appreciated.
Thanks
Comment #3
held69 commentedtry measured value field or check
http://drupal.org/node/620484