Hi,
I like to search big htm-files for certain signalwords, then extract the information that follow-up these signalwords and put them in a form that is friendly for *.csv . I do it using global vars and but there is a problem. It looks like this:
The htm-files look like this:
1.htm
fdskjfhsd
votes
9876
sdfsdf
2.htm
sdfsdf
votes
14323
3.htm
sdfdsgf
asfddsf
asdsa
What I do is:
restrict to lines matching ^votes (with context line 1 After the match)
--> subfilter
capture to variable "votes" ([X] Reset to initial value at start of each file) with the Initial Value .
then I remove all the content of the htm and add a header with the value of votes (@votes). Finally I append everthing in one *.csv
generally this works well, but not so well if textpipe doesnt find "votes", like in 3.htm in my example. then the result is NOT
9876
14323
.
..as I expected it to be but:
9876
14323
14323
..which gives me the impression the RESET doesnt work... what can I do to ensure a proper reset to the initial value?
greetings
S.
Problems with initial value of global var
Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators
- DataMystic Support
- Site Admin
- Posts: 2227
- Joined: Mon Jun 30, 2003 12:32 pm
- Location: Melbourne, Australia
- Contact:
Re: Problems with initial value of global var
Since your capture is inside a subfilter, you need to reset at the start of each Region (and/or file), as subfiltered text is treated slightly differently to a file.
Also- note that you can Copy/Paste a filter as text like that below:
Restrict to lines matching [^votes]
| [ ] Include line numbers
| [ ] Include filename
| [ ] Match case
| [ ] Count matches
| Pattern type: 0
| Context before: 0
| Context after: 1
|
+--Capture to variable @votes
Reset for both
Also- note that you can Copy/Paste a filter as text like that below:
Restrict to lines matching [^votes]
| [ ] Include line numbers
| [ ] Include filename
| [ ] Match case
| [ ] Count matches
| Pattern type: 0
| Context before: 0
| Context after: 1
|
+--Capture to variable @votes
Reset for both
Re: Problems with initial value of global var
thanks, as you suggested I just added a
Capture to variable @varname
outside the RESTRICTED subfilter and now it works.
Capture to variable @varname
outside the RESTRICTED subfilter and now it works.