Tags:
create new tag
view all tags

Question

I have created a form called ServerInfoForm. In this form I include information like Hostname, IP Address, Memory, etc.

Every server has it's own Topic page with this same form.

Is it possible to query the data in all forms to get, for example, a list of the IP addresses on each server in a simple 3 columned table? The columns being:

Topic Name Hostname IP Address

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Ubuntu Server 6.10, Kernel 2.6.17-10
Web server: Apache 2.0.55
Perl version: 5.8.8
Client OS:  
Web Browser:  
Categories: Forms, Search

-- RyanBauerle - 17 Sep 2007

Answer

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.

That would sound like a perfect job for FormQueryPlugin! You should read the FormQueryPluginTutorial first, since the plugin topic is very technical. I dare to mark your question as "answered", but if you need further assistance, don't hesitate to re-open it.

-- HaraldJoerg - 18 Sep 2007

Even without the FormQueryPlugin, this looks like a simple FormattedSearch. See all VarSEARCH options.

If you want to go fancy, the TWikiInstallation directory is a sample application that has a SEARCH with a filter.

-- PeterThoeny - 18 Sep 2007

Thanks. I was able to install the plugin from the configure interface and I read through the turorial, but I'm still having trouble with the syntax. Do you think you can give me another push in the right direction?

Thanks

-- RyanBauerle - 18 Sep 2007

Peter and Harald, thanks for your responses.

Before Harald gave the idea of the plugin, I had searched through the topics that Peter mentioned. But in both cases I am having trouble getting the syntax right.

Any chance you can provide a little more help?

-- RyanBauerle - 18 Sep 2007

Sorry guys...now I feel dumb because it is so simple now that I got it to work the first time. Thanks for your help!

Here is what I did:

| *Topic:* | *HostName:* | *IpAddress1:* |
%SEARCH{ "[H]ostName.*?value=\"*\"" scope="text" regex="on" nosearch="on" nototal="on"
  format="| [[$topic]] | $formfield(HostName) | $formfield(IpAddress1) |" }%

Thanks!

-- RyanBauerle - 18 Sep 2007

No need to feel dumb. Though I'm using TWiki for some years now, it almost always takes me some experiments to get the syntax right. I should feel silly for recommending a solution which is nothing but over-engineering for your use case. Glad you figured out the simple solution smile

-- HaraldJoerg - 18 Sep 2007

I was able to use the modified code provided by Ryan to retrieve fields from my forms; however, I have the following 2 questions:

  • The search also returned record for the topic where the form is defined. How can this be prevented?
  • What exactly does the "[H]ostName.*?value=\"*\"" regex mean? What is the syntax for value= ?

Thank you,

-- AndyAndrews - 31 Dec 2007

Question 1:

Use the excludetopic="" parameter. See details in VarSEARCH.

Question 2:

The regex seems to be incorrect. I'd search for the form name or the field, one of:

  • "META\:FORM.*name=\"FooBarForm\""
  • "META\:FIELD.*name=\"HostName\""

This searches the raw form data. Example format:

%META:FORM{name="FooBarForm"}%
%META:FIELD{name="HostName" attributes="" title="HostName" value="qwerty"}%

-- PeterThoeny - 31 Dec 2007

Change status to:
Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2007-12-31 - 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.