Tags:
create new tag
view all tags

Question

I have a form of type:

MyFormOne:

Name Type Size Values Tooltip message Attributes
Name text 40      
List text 40      
...

A topic of that form (MyFormOne) looks like this:

Name My name
List TopicOne, TopicTwo, TopicThree

I assume all topics in the List row are of a form MyFormTwo which turns to be like this:

MyFormTwo:

Name Type Size Values Tooltip message Attributes
Name text 40      
AnAttribute text 40      

I want for a Topic of the form MyFormOne, display in a table, each topic of the List... and display for each topic in that list, the correspond AnAttribute. Example:

I have done many experience with the nested search but could not succeed.

Please help.

Environment

TWiki version: unspecified
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories:  

-- AlainLavoieDexto - 11 Jul 2008

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.

Which step is it that you are having trouble with?:

  1. Getting the list of topics
  2. Splitting the list so that each topic becomes a search value
  3. Looking up the attribute for each value

I suspect it's step #2. Here's one way to do that:

   %CALC{$SET(list, TopicOne, TopicTwo, TopicThree)}%
   * %CALC{$LISTJOIN($n$sp$sp$sp*$sp, $GET(list))}%

Which renders like this:

Of course you would use %FORMFIELD% to get the real string, instead hard-coding it like I did.

If I misunderstood your question, perhaps you could create an example in the Sandbox web for us to look at.

-- SeanCMorgan - 14 Jul 2008

Your suggestion is good, but I could not display the "TheAttributeValue" of each topic hit. I am starting to think that I am trying to acheive something that twiki is not made for. I wish to continue with Twiki alone, because of the history changes that I can access at any time, but because of complexity searches or display, I might have to consider linking twiki with a MySql server. I will lose my history log in process but I need some complex search capability.

Thanks anyway.

-- AlainLavoieDexto - 17 Aug 2008

Instead of Name/List as field in MyFormOne, could you use the parent relationship: Name is the parent topic, and the others the children? That would seem to be a more appropriate use of TWiki, and the attribute listing would then be quite straightforward.

-- SeanCMorgan - 18 Aug 2008

If you can't use a parent relationship, then here's a solution. You need the WebPreferences to be updated in order to follow the "add form" link and update forms values. It works on TWiki 4.2.2 / freebsd 6.3. Please confirm it works for you. I used the same forms variables as you did your example :

The first search is :

%SEARCH{ "^%META.*List.*value\=.*" nosearch="on" nototal="on" web="Sandbox"  type="regex" format="   * $topic $n      * $formfield(List)" }%
The second search is :

%SEARCH{ "^%META.*AnAttribute.*value\=.*" nosearch="on" nototal="on"  web="Sandbox" type="regex" format="   * $topic 's Anattribute value is : $formfield(AnAttribute)" }%
Then I use the first search followed by the second search in a "Nested Search" ( see FormattedSearch ) :
%SEARCH{ "^%META.*List.*value\=.*" topic="*" nosearch="on" multiple="on" nototal="on" web="Sandbox"  type="regex" format="   * $topic $n$percntSEARCH{ search=\"^%META.*AnAttribute.*value\"  topic=\"$formfield(List)\" type=\"regex\" multiple=\"on\"  format=\"      * $dollartopic 's Anattribute value is $dollarformfield(AnAttribute) \" nosearch=\"on\" nototal=\"on\" separator=\"$dollarn\" }$nop%" nosearch="on" separator="$n"  nototal="on" }%

Note : change topic="*" to a more restricted pattern to avoid performance issue. Hope this helps.

-- OlivierThompson - 18 Aug 2008

Thanks Olivier,

It works perfectly. Finally, since Sean brought the parent-children relationship into the subject, would it be more efficient to proceed as he propose. What would the appropriate syntax ?

-- AlainLavoieDexto - 04 Sep 2008

Also refer to SearchPatternCookbookNestedForms

-- AlainLavoieDexto - 04 Sep 2008

Here is a nested search using the parent-children relationship twice. See also TreePlugin and TreeBrowserPlugin. The formfields I used are the same as in SearchPatternCookbookNestedForms.
If you can avoid complexity, then "keep it simple" with parent-children relationship. Hope this helps.

%SEARCH{ "^%META\:TOPICPARENT.*\"%TOPIC%\"" topic="Book*" type="regex" nonoise="on" format="   * [[$topic]] $n$percntSEARCH{ search=\"^%META\:TOPICPARENT.*$topic\"   type=\"regex\" multiple=\"on\"  format=\"      * $dollartopic : ISBN $dollarformfield(ISBN) \" nosearch=\"on\" nototal=\"on\" separator=\"$dollarn\" }$nop%" separator="$n" excludetopic="*Form"}%

-- OlivierThompson - 07 Sep 2008

Thanks to all.

-- AlainLavoieDexto - 12 Sep 2008

-- AlainLavoieDexto - 12 Sep 2008

Change status to:
Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r10 - 2008-09-12 - AlainLavoieDexto
 
  • 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.