Tags:
create new tag
view all tags

SID-00589: Complex calculation in a SEARCH

Status: Answered Answered TWiki version: 4.1.0 Perl version: Not sure
Category: SpreadSheetPlugin Server OS: RedHat Linux Last update: 16 years ago

I am trying the following:

%CALC{$SET(monthold, $TIMEADD($TIME(), -1, month))}% %CALC{$SET(dayold, $TIMEADD($TIME(), -1, day))}%

%SEARCH{ "META\:FORM.*name\=.*CatalogCardCAB;META\:FIELD.*name\=.*Status.*value=.*Dispositioned.*" regex="on" web="all" nosearch="off" order="$web.$topic" header="|*Doc Title*|*Create Date*|*Last Updated*|*Updated By*|*Rev*|*Doc Status*|" format="$percntCALC{$IF($AND($TIME($date) > $GET(monthold), $TIME($date)< $GET(dayold))==0 ,<nop> , | $topic | $createdate | $date | $wikiname | $rev | $formfield(Status) | ) }% " }%

But the IF statement isn't being figured correctly. Is there any way to do a SEARCH of articles with a last updated date between two different days? Basically what I am working toward is listing all of the pages that I have that were set into Dispositioned between in a particular month, but first I have to get my complex $IF statement working correctly.

Any help would be appreciated. I've been pounding on this for several hours now in various forms and just can't figure it out.

-- DrewNorman - 2009-10-27

Discussion and Answer

For one thing, you didn't escape the closing % of the CALC. But I can't recall if that's mandatory.

> But the IF statement isn't being figured correctly.

In what way? An example (here, or in the Sandbox web) would really help.

-- SeanCMorgan - 2009-10-27

You need to escape the closing % of CALC in a SEARCH format, such as }$percnt

BTW, you can add more than one formula into the same CALC; simply add one after another. Your example:

%CALC{$SET(monthold, $TIMEADD($TIME(), -1, month))$SET(dayold, $TIMEADD($TIME(), -1, day))}%

-- PeterThoeny - 2009-10-27

http://twiki.org/cgi-bin/view/Sandbox/RandomTestTopic87593

is basically what I'm trying to do. I'm trying to list all of the topics which have been changed in the month of September (the second query) but it returns the same thing as my first query, which is all the topics in my query.

How can I create a search that only returns what was changed in a certain month?

Thanks!

-- DrewNorman - 2009-10-27

I'm not sure what happened, but I seem to have broken your test page!

Basically, I was trying to remove the "==0" from your AND, since its return value can be used with the IF as-is:

$IF($AND(a, b), value if true, value if 0)

BTW, TWiki.QuerySearch is probably a better way to include a topic's revision date in a search.

-- SeanCMorgan - 2009-10-27

Can you give me an example of using Search to search for pages with a particular topic to match and being between two dates? I have updated this page:

http://twiki.org/cgi-bin/view/Sandbox/RandomTestTopic87593

Trying to do the Search, but it didn't work.

Thanks!

-- DrewNorman - 2009-10-28

I should add, I have an example trying to use IF to do the search, as well as trying to just use Search. Neither one seems to work.

-- DrewNorman - 2009-10-28

I may have this working... I'll update a bit later.

-- DrewNorman - 2009-10-28

OK. I can't figure this out and it is killing me. All I want to do is a search on the following:

META\:FORM.*name\=.*CatalogCardMCAB;META\:FIELD.*name\=.*Status.*value=.*New.*;

for topics modified between a certain begin date and end date.

How hard can that be? For some reason it is way too hard for me.

-- DrewNorman - 2009-10-28

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 - 2009-12-03

      Change status to:
ALERT! 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.
SupportForm
Status Answered
Title Complex calculation in a SEARCH
SupportCategory SpreadSheetPlugin
TWiki version 4.1.0
Server OS RedHat Linux
Web server Not sure
Perl version Not sure
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r9 - 2009-12-03 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.