This question about Topic Markup Language and applications: Answered

Use SEARCH to create a dropdown of all users

I use a form to categorize topics, similar to the form in this Support web. One of the form fields is content owner which is currently just a text field but should be a dropdown list of registered users ( WIKINAME, specifically). I am aiming for a result without the Main. prefix, to make just the wikinames appear in the dropdown list. I want a table like this:
Name
UserOne
UserTwo
(etc.)

So I would make a search along the lines of:
%SEARCH{ type="query" "System.UserForm[...//not sure how to query this//" 
nosearch="on" order="topic" limit="all" header="|*Name*|" format="| //$usernamesgoheresomehow// |"}%

But even referring to QuerySearch I can't figure out how to actually get to the usernames?

Note: I can't simply create the wikinames by concatenating UserForm.FirstName and UserForm.LastName because at least one user has a hyphen in the last name.

-- TorbenGB - 21 Jul 2010

To get a list of all topics with a form called "UserForm" use the following query search:
%SEARCH{"fields[name='FirstName']" type="query" web="%MAINWEB%" format="| !$topic |" nonoise="on" header="|*Name*|"}%

Note: This search gets quite slow if you've got lots of users (like here on Foswiki.org)

-- MartinKaufmann - 22 Jul 2010

Thank you Martin, the solution works and seems quite simple, except that I don't see UserForm mentioned? So I guess the search just looks for any form that has a field called FirstName, and if I would happen to use that label in another form too, then topics using that other form would also be listed, right?

MAINWEB is deprecated so your example didn't work on my installation. The documentation suggests using USERSWEB instead, which works.

-- TorbenGB - 23 Jul 2010

Sorry, I copied over the wrong search. Here is the one containing UserForm:
%SEARCH{"form.name ~ '*.UserForm'" type="query" web="%USERSWEB%" format="| !$topic |" nonoise="on"}%

Result (I included a limit="10" to limit the number of results):
Name
AMStudyGroup
AaBb
AaaAa
AaaaBbbb
Aali61Ali
AaranGrimley
AarasSmithh
AaronC
AaronCharlson
AaronForward

-- MartinKaufmann - 23 Jul 2010

Thank you Martin!

-- TorbenGB - 26 Jul 2010

QuestionForm edit

Subject Topic Markup Language and applications
Extension
Version Foswiki 1.0.9
Status Answered
Topic revision: r6 - 21 Dec 2010, TorbenGB
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