Tags:
create new tag
view all tags

Question

I have tried to search the answered questions for this, but without success... Is it possible to use some kind of search that searches a page and then includes all the found topics dynamically?

I've tried this (in Sandbox):

%SEARCH{ search="Record" topic="SandBox38Linking" multiple="on" nosearch="on" nototal="on" regex="on" noheader="on" format="%<nop>INCLUDE{\"[[$pattern(\|\sRecord\s\|\s([^ ]*).*)]]\"}<nop>%"}%

But without success, the result is series of unevaluated

%INCLUDE{"Topic"}%. 
I guess I could explain this a little. I need to create linking between two topics for many-to-many database. So far I've managed to use

%COMMENT{...}%

to append a new link to a link page. Now I need a way to display this connection. Another approach could be to extract info from these pages, i.e.

  • search the page that includes all the relevant Wiki-words (linkings), example of this page:
Risk2002020202 Mitigation202022929
Risk2002020201 Mitigation202022927
Risk2002020203 Mitigation202022928
  • extract info from the found links, e.g. by $pattern(...)

Environment

TWiki version: TWikiRelease02Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server: twiki.org server
Perl version:  
Client OS:  
Web Browser: Internet explorer 6.0.2800.11060CO
Categories: Search

-- MikkoLaakso - 16 Sep 2005

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.

I think $text in a FormattedSearch should do what you want.

You can also use an INCLUDE within a format="", the trick is the delay the include so that it executes once for each search hit. Do that with format="$percntINCLUDE{...}$percnt".

You might also find DashboardWithDynamicTable helpful.

-- PeterThoeny - 20 Sep 2005

That was very helpful, thanks Peter! I will finetune my search and come back to share it here...

-- MikkoLaakso - 23 Sep 2005

Ok, the solution was to use a search that

  • Searches a page for certain type of links (namely links that have a record-tag in front of them
  • for every line found, a nested search will use the link in this line as its topic and will fetch data to a formatted field, e.g. all the lines with "Precondition:" in front of them
The link-page form is
|*Linked risks*|
| <!--record--> RiskT20050919093800 Uninitialized RAM-device |
| <!--record--> RiskT20050915075955 Exposed product info |
...and the script for searching is
%SEARCH{ search="[\<][\!][\-][\-]record[\-][\-][\>]" topic="%BASETOPIC%" multiple="on" nosearch="on" nototal="on" regex="on" noheader="on" format="$percntSEARCH{ \".\" nosearch=\"on\" nototal=\"on\" regex=\"on\" noheader=\"on\" topic=\"$pattern(\|\s[\<][\!][\-][\-]record[\-][\-][\>]\s*([^ ]*).*)\" format=\"|$dollarpattern(.*Precondition\:([^\r\n]*).*)|$dollarpattern(.*Action\:([^\r\n]*).*)|$dollarpattern(.*Consequence\:([^\r\n]*).*)|\" }$percnt" }% 

So how is this useful? With this kind of search, I can have a database where all my linking is in one page, I can make a search to this page and find fields from the records (linked pages)! It's many-to-many relationship. Alternatively, I can create my links to a record, and find fields from these links by searching the same record (page). I'm not sure how clearly I managed to express this... any questions? Please ask.

-- MikkoLaakso - 23 Sep 2005

That certainly works nicely. Small suggestion: <record> won't XHTML validate. You could use <!--record--> instead.

-- PeterThoeny - 23 Sep 2005

Ok, [\<][\!][\-][\-]record[\-][\-][\>] seems to do the job. I updated this to the search script.

-- MikkoLaakso - 26 Sep 2005

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2005-09-26 - MikkoLaakso
 
  • 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.