You are here: Foswiki>Tasks Web>Item4798 (26 Nov 2007, SvenDowideit)Edit Attach

Item4798: TWiki variables such as CALC are not expanded inside formatted search if CALC is also used elsewhere on same line

pencil
Priority: Normal
Current State: Confirmed
Released In:
Target Release: minor
Applies To: Extension
Component: SpreadSheetPlugin
Branches:
Reported By: TWiki:Main.EricCharikane
Waiting For:
Last Change By: SvenDowideit
I'm using the new type=query in a formatted search that return the expected result but a CALC{"$ROW()"} at the bottom of this formatted search as usual gives now a bad result though the same works fine with a formatted search of type=regex for example ? This a bit anoying !

-- TWiki:Main/EricCharikane - 11 Oct 2007

Trying to reproduce the issue here on bugs web.

It would be so much easier for us developers if people would put the failing example in the bug report instead of us spending an hour making a test case.

First a simple regex search

1 1 1

And then a query search. Not looking for the same but with similar formatted table.

1 1 1

and now a manual table

Row Id Summary
2 Item1234 Some text
3 Item1234 Some text
4 Item1234 Some text
5 Item1234 Some text
6 Item1234 Some text
7 Item1234 Some text
8 Item1234 Some text
9 9 9

After some trials and some problems getting things to work I finally managed to get the searches with CALC in the format working. The problem is that the CALC must not be run until the table is created. So we need the search to finish. The usual way to do that is to change the % to $percnt inside the format string. But then the "} is no longer inside a twiki variable and the format string terminates too early. The fix of that is to escape the quotation marks with \" or use $quot.

But no matter what - I see no difference between the query and the regex searches.

So what is the problem?

My guess is you have a plain error in your search string.

Lowering to normal to not list it in release blockers and waiting for feedback. If no feedback is given within a few days we set it to No Action. If the reporter finds the syntax error please give feedback and set to No Action Required.

-- TWiki:Main.KennethLavrsen - 11 Oct 2007

Dear Kenneth, thank you for the reply and the examples and sorry for this report too lite (and which may not be a bug). But for a new comer like me, it's far from obvious to understand that adding a %CALC% somewhere will break a %CALC% somewhere else and that you need to rewrite your Search query to escape some things.

Here a working example of what drove me here.

This query looks like good
%SEARCH{ " info.date >= '%CALC{"$TIME(2007/06/12)"}%' " web="LitterTray" type="query" nototal="on" topic="Item*" header=" |* Raw *|* Topic *|* Date *| " format=" | | $web.$topic | $date | " }%
see the result (except for the last item which should not be here or may be its special !).

Searched: info.date >= '1181606400'

Now adding a CALC inside and at the bottom like yours
%SEARCH{ " info.date >= '%CALC{"$TIME(2007/06/12)"}%' " web="LitterTray" type="query" nototal="on" topic="Item*" header=" |* Raw *|* Topic *|* Date *| " format=" | $percntCALC{\"$ROW()\"}$percnt | $web.$topic | $date | " }%
| %CALC{"$ROW()"}% | | |
and it doesn't work anymore. And I can't figure out what to do to have it works as expected even by trying many way to escape the different things ? I would very appreciate any advise about this behavior.

Searched: info.date >= '1181606400'
1    

Thank you, Best regards,

-- EricCharikane - 12 Oct 2007

Seems related to weather CALC has been running before. If I remove the first calc the 2nd one works. Below I replaced the first CALC with a fixed number.

Searched: info.date >= '1181599200'
1    

This seems like a bug to me. And it has nothing to do with query vs regex.

Changing the header to reflect the real problem.

TWiki variables such as CALC are not expanded inside formatted search if CALC is also used elsewhere on same line

It may have something to do with either the fact that Spreadsheet Plugin is running last - or that it is an old plugin that expands via a regex instead of registring the tag.

Changed the searches to look in LitterTray web to speed up topic loading.

-- TWiki:Main.KennethLavrsen - 13 Oct 2007

ItemTemplate edit

Summary TWiki variables such as CALC are not expanded inside formatted search if CALC is also used elsewhere on same line
ReportedBy TWiki:Main.EricCharikane
Codebase 4.2.0
SVN Range TWiki-4.3.0, Sat, 06 Oct 2007, build 15172
AppliesTo Extension
Component SpreadSheetPlugin
Priority Normal
CurrentState Confirmed
WaitingFor
Checkins
TargetRelease minor
ReleasedIn
Topic revision: r5 - 26 Nov 2007, SvenDowideit
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