You are here: Foswiki>Tasks Web>Item10278 (09 Sep 2016, MichaelDaum)Edit Attach

Item10278: exclude parameter doesn't seem to work (or not as expected)

pencil
Priority: Normal
Current State: No Action Required
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: FilterPlugin
Branches:
Reported By: VickiBrown
Waiting For:
Last Change By: MichaelDaum
According to Extensions.FilterPlugin

exclude="...": skip occurences that match this regular expression

However, I've tried various combinations and can't seem to make exclude work.

Unfortunately, there are no "exclude" examples in the docs.

For example, say I want to exclude any header lines. The example at Extensions.FilterPlugin uses skip but let's imagine I have several tables, so "skip" isn't going to help.

I should be able to use exclude to exclude header rows, e.g. matching the pattern \|\s*\*.

No matter what patterns I try or where I put exclude in the argument list, I cannot get these rows to be excluded.

%STARTINCLUDE%
---+++ Extract table data 1
| *Pos* | *Description* | *Hours* |
|  1 | onsite troubleshooting |  3 |
|  2 | normalizing data to new format |  10 |
|  3 | testing server performace |  5 |

---+++ Extract table data 2
| *Pos* | *Description* | *Hours* |
|  1 | onsite testing |  4 |
|  2 | converting data to secondary format | 8 |
|  3 | upgrading OS |  12 |
%STOPINCLUDE%

%EXTRACT{topic="Item10278" 
  expand="off" 
  pattern="\|\s*(.*?)\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|" 
  format="   * it took $3 hours $2$n"
  exclude="\|\s*\*"
}%

Extract table data

Pos Description Hours
1 onsite troubleshooting 3
2 normalizing data to new format 10
3 testing server performace 5

Extract table data 2

Pos Description Hours
1 onsite testing 4
2 converting data to secondary format 8
3 upgrading OS 12

  • it took Hours hours Description
  • it took 3 hours onsite troubleshooting
  • it took 10 hours normalizing data to new format
  • it took 5 hours testing server performace
  • it took Hours hours Description
  • it took 4 hours onsite testing
  • it took 8 hours converting data to secondary format
  • it took 12 hours upgrading OS

-- VickiBrown - 21 Jan 2011

That's probably a docu flaw: the exclude pattern is checked against the formatted string, not the list item from the source. So your app should be fine using

%EXTRACT{topic="%TOPIC%" 
  expand="off" 
  pattern="\|\s*(.*?)\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|" 
  format="   * it took $3 hours $2$n"
  exclude=".*\*Hours\*.*"
}%

... as Hours is still part of the output.

Let's check this out:

  • it took 3 hours onsite troubleshooting
  • it took 10 hours normalizing data to new format
  • it took 5 hours testing server performace
  • it took 4 hours onsite testing
  • it took 8 hours converting data to secondary format
  • it took 12 hours upgrading OS

-- Main.MichaelDaum - 09 Sep 2016 - 09:49

 

ItemTemplate edit

Summary exclude parameter doesn't seem to work (or not as expected)
ReportedBy VickiBrown
Codebase
SVN Range
AppliesTo Extension
Component FilterPlugin
Priority Normal
CurrentState No Action Required
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release02x01Checkins
Release02x00Checkins
Release01x01Checkins
Topic revision: r2 - 09 Sep 2016, MichaelDaum
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