This question about Documentation: Answered

How to find pages that don't have a DataForm?

I've got a documentation web that has a DocumentationForm attached. The form contains a ContentOwner, DocumentationStatus, and so on.

I want to find all the topics in the web that don't have this DataForm attached.

Answer

I thought of a solution myself and wanted to share it with the community in case anybody else ever needs this:

I can set up a normal search similar to "list all topics" and also include a column that reads the value of one of the mandatory fields in the DataForm -- if this value is empty, then I know it's a topic that doesn't have the form!

%SEARCH{search="*" web="%BASEWEB%" 
order="topic" limit="all" nosearch="on" 
header="| *Topic* | *ContentOwner* |" 
format="| [[%BASEWEB%.$topic][$topic]] \
| <nobr><span class=\"foswikiGrayText foswikiSmall\">$formfield(ContentOwner)</span></nobr> \
|" 
nonoise="on" 
}%

Now I just click the ContentOwner column heading to sort by this column, and all the non-DataForm'ed pages will be listed together.

This can be made more elegant, but the problem is solved!

-- TorbenGB - 14 Dec 2010

Shouldn't the following query search do the same directly?
%SEARCH{
"NOT (form.name='DataForm')"
web="%BASEWEB%"
type="query"
limit="10"
order="topic"
nonoise="on"
format="   * [[%BASEWEB%.$topic][$topic]]" 
}%

-- FranzJosefGigler - 14 Dec 2010

Took the liberty to fix a spelling in format and make a verbatim section of your search.

-- LarsEik - 15 Dec 2010

Yes Franz Josef, you're right, that's a much more elegant way. I didn't know about the "NOT()" operator, how very useful! (I also added limit="10" to your example.)

-- TorbenGB - 15 Dec 2010

Wasn't sure at all that it would work, but as Crawford enhanced the operators of the query search lately I took another glimpse into the documented syntax and voila, it works! smile

-- FranzJosefGigler - 15 Dec 2010

QuestionForm edit

Subject Documentation
Version Foswiki 1.1.2
Status Answered
Topic revision: r6 - 21 Dec 2010, TorbenGB - This page was cached on 12 Nov 2018 - 18:34.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy