SID-01011: Blank date field in form renders as current date in search
Status: |
Answered |
TWiki version: |
4.2.0 |
Perl version: |
|
Category: |
CategorySearch |
Server OS: |
|
Last update: |
13 years ago |
I'm using a formatted query search to display a list of topics based on form data. The form has a few different date fields, and not all of them are filled in for every topic. For those that don't have a date filled in, the formatted query search seems to default to setting the date as today's date.
Below is a a copy of of the SEARCH variable that I'm using. The field in question is the
PublishBy field. Any topic with a blank
PublishBy field shows up in the search results of having a
PublishBy date of today. Any help with this issue would be greatly appreciated!
%TABLE{sort="on" initsort="1" initdirection="down" columnwidths="10%, 20%, 20%, 10%, 10%, 10%, 10%, 10%"}%
| Publish By | Title | Short Description | Themes | RSF Highlights | Target Outlets | Priority |
%SEARCH{"web = 'Communications/CommGuide' AND form.name = 'StoryForm' AND (Stage = 'Unassigned' OR Stage = 'On Hold')" type="query" nosearch="on" nototal="on" excludetopic="StoryTopicTemplate" format="| $percntCALC{$FORMATTIME($TIME($formfield(PublishBy)), $year-$month-$day)}$percnt | [[$web.$topic][$formfield(Title)]] | $formfield(ShortDescription) | $formfield(Themes) | $formfield(RSFHighlights) | $formfield(TargetOutlets) | $formfield(Priority) |" }%
--
GarySprague - 2010-11-03
Discussion and Answer
This is the spec of the
$TIME()
function, an empty parameter results in the current timestamp, see
SpreadSheetPlugin. Fix: Do a conditional "if". Untested:
$IF($EXACT($formfield(PublishBy), ), , $FORMATTIME($TIME($formfield(PublishBy)), $year-$month-$day))
--
PeterThoeny - 2010-11-03
Closing this question after more than 30 days of inactivity. Feel free to reopen if needed. Consider engaging one of the
TWiki consultants if you need timely help. We invite you to
get involved with the community, it is more likely you get community support if you support the open source project!
--
PeterThoeny - 2011-01-04
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.