This question about Documentation: Answered

Search for other topics that contain a given value in a given DataForm field

I want to create a search (for use in a macro) along these lines: show me a list of pages in which the field Extension contains the same value as the current topic's field Extension.

This question is very similar to Question575, with one important difference:

MartinKaufmann gave this solution, but I need to modify it and lack the regex skills:
%SEARCH{type="query" "QuestionForm[name='Extension'].value='%FORMFIELD{Extension}%'"}%

I have tried adding the regex wildcard .* so the search would be
"QuestionForm[name='Extension'].value='.*% FORMFIELD{Extension}%.*'"
but the result is empty (I deliberately added the space in this example; it's not in the actual search of course).

Here is an example using Attachment instead of %FORMFIELD {Extension}% that should show topics whose Extension contain "Attachment":
%SEARCH{type="query" limit="3" "QuestionForm[name='Extension'].value='.*Attachment.*'"}%
And in use:
Searched: QuestionForm[name='Extension'].value='.*Attachment.*'
Number of topics: 0

How can I properly add wildcards to the search?

Answer

You can try FormFieldListPlugin.

-- ArthurClemens - 05 Aug 2010

I think you need to change the operator from = to ~ as it says in the QuerySearch. Should not need extra plugins for this.

%SEARCH{type="query" limit="3" "QuestionForm[name='Extension'].value ~ '.*Attachment.*'"}%

-- LarsEik - 05 Aug 2010

A-HA! Thank you LarsEik for the link to QuerySearch. I tried your exact suggestion but that didn't work. Then I read http://foswiki.org/System/QuerySearch#Operators and found that the wildcard operator is not regex but simply *. So this works:
%SEARCH{type="query" limit="3" "QuestionForm[name='Extension'].value~'*Attachment*'"}%
gives:
Searched: QuestionForm[name='Extension'].value~'*Attachment*'

Results from Support web retrieved at 15:48 (GMT)

Question1041
Hi there, The task I have is: on a wiki page there is an attached file, a certain logbook, which is synchronized, i.e. downloaded to ../pub/ from another machine via ...
Question459
How do I fix this issue (error output below)? I'm using the latest AbiWord (2.8) and foswiki 1.09. AbiWord to=html %ATTACHDIR F% %SRC F% %DEST F% failed with exit ...
Question628
I am using abiword to convert word attachments into html because wvHtml is not able to handle MS Word 2007 docx files. Unfortunately this plugin relies on the exact ...
Number of topics: 3

-- TorbenGB - 06 Aug 2010
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons LicenseGet Foswiki at sourceforge.net. Fast, secure and Free Open Source software downloads