Quote:
Originally Posted by ownedbycats
Code:
program:
readgoal = strcat('readinggoal:', format_date(today(), 'yyyy'));
challenge = strcat('rgchallenges:purchases', format_date(today(), 'yyyy'));
if
format_date($date, 'yyyy') == format_date(today(), 'yyyy')
&& readgoal in $#admintags
&& $#purchasesource
&& $#cost !='0.00'
then
list_union(challenge, $#admintags, ',')
else
$#admintags
fi
Line 7 I'm trying to check whether the book's timestamp/date is set to this year. Is this the best method to do so?
|
I can't think offhand of a better way without using a python stored template. That said, changing
format_date($date, 'yyyy') to
format_date_field($date, 'yyyy') will be faster.
EDIT: For consistency with
field_list_count() and the new operator
field_inlist (addition submitted to Kovid) I submitted a change to rename
format_date_field() to
field_format_date(). The old name
format_date_field() is an alias and will continue to work. My intention is that any new functions and operators that work on fields will be prefixed with 'field_'.
EDIT2: I might reverse the naming convention and put the _field at the end, changing field_list_count() to list_count_field(). The new operator would be inlist_field instead of field_inlist. In this case the format_date_field() wouldn't be renamed. Still thinking ...