Tags:
create new tag
view all tags

Question

Is there a way to make the row numbers appear in tables constructed using the %SEARCH% function ?

I tried the option of including %CALC{"$ROW()"}% as given below:

%SEARCH{ "^Automatic" web="%WEB%" scope="topic" type="regex" nosearch="on" order="modified" reverse="on" format="| %CALC{"$ROW()"}% | [[$topic]] | $createwikiname | $createdate | $wikiname | $date |" }%

This gives the same number for all rows, as given below:

0 AutomaticIncrementIdInAForms AlainLavoieDexto 2008-06-25 - 19:35 PeterThoeny 2008-08-19 - 06:48
0 AutomaticLogoutUsingFirefox KirstinWeber 2008-04-28 - 11:17 PeterThoeny 2008-06-03 - 01:07
0 AutomaticRowNumberInTables ChengappaCB 2008-05-22 - 10:57 ChengappaCB 2008-05-22 - 17:33
0 AutomaticallyPutNewUsersIntoGroup DanDeMeyere 2007-10-23 - 20:11 DanDeMeyere 2007-11-05 - 21:03
0 AutomaticallyCreateLinkToPages AlexRaabe 2006-08-25 - 11:25 PeterThoeny 2006-10-01 - 08:12
0 AutomaticRegistration PeterScott 2005-12-28 - 18:56 PeterThoeny 2006-03-07 - 06:21
0 AutomaticOutlookLink TWikiGuest 2005-11-08 - 18:09 PeterThoeny 2006-01-02 - 19:34
0 AutomaticHorizontalRuleAndSignature GeraldManipon 2003-12-03 - 20:00 PeterThoeny 2004-02-01 - 11:41
0 AutomaticPageCreation KevinWalker 2002-05-04 - 02:47 PeterThoeny 2002-05-04 - 07:13
Number of topics: 9

It works for 'normal' tables though, as given below with:

| %CALC{"$ROW()"}% | test1 |
| %CALC{"$ROW()"}% | test2 |
| %CALC{"$ROW()"}% | test3 |

1 test1
2 test2
3 test3

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin, SpreadSheetPlugin
Server OS: Windows 2000
Web server: Apache 1.3.39
Perl version: 5.008008 (cygwin)
Client OS: Windows XP
Web Browser: IE 6
Categories: Missing functionality

-- ChengappaCB - 22 May 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.

You have to escape (or remove!) the quotes inside CALC{}, otherwise SEARCH{} can't parse format="..CALC{".."}.."=. But that gives the same number for each row:

8 AutomaticIncrementIdInAForms AlainLavoieDexto 2008-06-25 - 19:35 PeterThoeny 2008-08-19 - 06:48
8 AutomaticLogoutUsingFirefox KirstinWeber 2008-04-28 - 11:17 PeterThoeny 2008-06-03 - 01:07
8 AutomaticRowNumberInTables ChengappaCB 2008-05-22 - 10:57 ChengappaCB 2008-05-22 - 17:33
8 AutomaticallyPutNewUsersIntoGroup DanDeMeyere 2007-10-23 - 20:11 DanDeMeyere 2007-11-05 - 21:03
8 AutomaticallyCreateLinkToPages AlexRaabe 2006-08-25 - 11:25 PeterThoeny 2006-10-01 - 08:12
8 AutomaticRegistration PeterScott 2005-12-28 - 18:56 PeterThoeny 2006-03-07 - 06:21
8 AutomaticOutlookLink TWikiGuest 2005-11-08 - 18:09 PeterThoeny 2006-01-02 - 19:34
8 AutomaticHorizontalRuleAndSignature GeraldManipon 2003-12-03 - 20:00 PeterThoeny 2004-02-01 - 11:41
8 AutomaticPageCreation KevinWalker 2002-05-04 - 02:47 PeterThoeny 2002-05-04 - 07:13
Number of topics: 9

So you also need to defer the CALC so that it gets executed once per search result, as described in "Search with conditional output" in FormattedSearch:

1 AutomaticIncrementIdInAForms AlainLavoieDexto 2008-06-25 - 19:35 PeterThoeny 2008-08-19 - 06:48
2 AutomaticLogoutUsingFirefox KirstinWeber 2008-04-28 - 11:17 PeterThoeny 2008-06-03 - 01:07
3 AutomaticRowNumberInTables ChengappaCB 2008-05-22 - 10:57 ChengappaCB 2008-05-22 - 17:33
4 AutomaticallyPutNewUsersIntoGroup DanDeMeyere 2007-10-23 - 20:11 DanDeMeyere 2007-11-05 - 21:03
5 AutomaticallyCreateLinkToPages AlexRaabe 2006-08-25 - 11:25 PeterThoeny 2006-10-01 - 08:12
6 AutomaticRegistration PeterScott 2005-12-28 - 18:56 PeterThoeny 2006-03-07 - 06:21
7 AutomaticOutlookLink TWikiGuest 2005-11-08 - 18:09 PeterThoeny 2006-01-02 - 19:34
8 AutomaticHorizontalRuleAndSignature GeraldManipon 2003-12-03 - 20:00 PeterThoeny 2004-02-01 - 11:41
9 AutomaticPageCreation KevinWalker 2002-05-04 - 02:47 PeterThoeny 2002-05-04 - 07:13
Number of topics: 9

You need to do both. If you only defer the CALC and leave the quotes in, you get...

| %CALC{ | %CALC{ | %CALC{ | %CALC{ | %CALC{ | %CALC{ | %CALC{ | %CALC{ | %CALC{

Number of topics: 9

-- SeanCMorgan - 22 May 2008

Perfect. Thank you very much Morgan. I should have seen the FormattedSearch before asking.

Do you by any chance have an answer to my other (still unanswered) question AccessRights ?

-- ChengappaCB - 22 May 2008

Change status to:
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2008-05-22 - ChengappaCB
 
  • 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.