By lavamind on
Hi,
In one of my node types, I've defined a Date field with a start and end date.
Using a view, I'd like to display a column that contains the yes/no result of checking whether the current date is within the period defined by my Date field.
I've examined the Computed Field module, but it won't work in my case : the value can't be stored in the database (changes every day) but non-database-stored computed fields can't be used in Views.
I'd like some guidance as to where to start. Do I need a formatter? A field handler? A plugin? Theming functions?
I know how to create custom modules in general, so that's not a problem.
Thank you!
Comments
I didn't really understand
I didn't really understand what it is that your trying to do.
could you explain more about your issue please.
what do you mean changes every day? does it change when you update your node?
Let's say my Date field has
Let's say my Date field has the range May 1 2012 to May 5 2012. If I load the view at any time within this range, I want the column to say 'yes', otherwise 'no'. In other words, it's a comparison between dates stored in a field, and the current (today) date.
If I was to store this 'yes' or 'no' in the database, then I would have to recalculate the result every day...
This is the page that helped
This is the page that helped me create a handler:
http://oliverhuynh.wordpress.com/2011/06/23/custom-views-handler-drupal-...
But for what you are describing, I don't think you need a handler. I'd create a global text field, which is assigned a machine name of nothing, nothing_1, etc. and then override the value using something like the following:
Cameron
Thanks for the reply. If I
Thanks for the reply.
If I understand correctly, however, that would set the same value for all rows in the column.
In my case, each node displayed in my view would have a different time period in its Date field. So for each node, I need to retrieve the content of the Date field and do the comparison.
What is the problem with
What is the problem with updating the value in database every day with cron?