Page 1 of 1
Please No carriage return after global variable
Posted: Mon Jul 27, 2009 6:21 am
by dnsm24
I have a simple filter which successfully assigns three sets of data (eg. data1, data2, data3) to three unique Global Variables (e.g. @variable1, @variable2, @variable3). I want to add these variables to a new line in a file, seperated by commas. However when I use this code;
@variable1, @variable2, @variable3
The data is output on three separate lines like this;
data1
data2
data3
Please - Is it possible to prevent the carriage return after each variable and thereby string them together with, or without punctuation between them, like this;
data1, data2, data3
The above only happens with user assigned global variables??
In the scenario described above - Global variables assigned by TextPipe pro (eg filename, date and time etc.) are treated differently from user assigned global variables in that a carriage return is NOT invoked i.e. this line of code;
@inputfilename, @time, @randomdigit
for example might produce this output;
myfilename, 21:00, 3409876
Re: Please No carriage return after global variable
Posted: Mon Jul 27, 2009 9:18 am
by DataMystic Support
Your capturing expression is also capturing the carriage returns - check the search/replace that precedes the capture. If you can't identify it, please paste the filter tree here (Right click it, and choose Copy).
Re: Please No carriage return after global variable
Posted: Mon Jul 27, 2009 9:51 am
by dnsm24
Here is a copy of the filter tree:
|--T-Filter
| |
| |--Extract [[day <-/ > monthname <-/ > year]]
| | [ ] Include line numbers
| | [ ] Include filename
| | [ ] Match case
| | [ ] Count matches
| | Pattern type: 4
| |
| +--Capture to variable @pubdate
| Reset: 1
|
|--T-Filter
| |
| |--Extract email addresses
| |
| +--Capture to variable @pubemail
| Reset: 1
|
|--Remove all
|
|--Insert lines at line 1 [@pubdate, @pubemail, @inputfilename]
|
+--Merge output to file c:\merge.txt
Re: Please No carriage return after global variable
Posted: Mon Jul 27, 2009 10:51 am
by DataMystic Support
Thanks - could you also upload the filter here and include sample data in the trial run area?
Re: Please No carriage return after global variable
Posted: Mon Jul 27, 2009 11:00 am
by DataMystic Support
Your filter doesn't take account of the way TextPipe works. The entire file will be processed through the first T filter before the result is passed to the next T filter.
If you're extracting more than one date/email from each file then this won't work. For one date/email per file it may work - I need to see the data to tell.
Re: Please No carriage return after global variable
Posted: Mon Jul 27, 2009 8:33 pm
by DataMystic Support
Ah - just found the reason for this. The extract filter automatically adds a line feed after found text.
Instead, use a pattern search/replace with the Extract Option enabled. We'll update the help to mention this on the Extract filter.
Code: Select all
|--Input from file(s)
| [ ] Confirm before processing each file
| [ ] Confirm before processing read/only files
| [ ] Delete input files after processing
| Process binary files
|
|--T-Filter
| |
| |--EasyPattern [[day <-/ > monthname <-/ > year]] with [$0]
| | [ ] Match case
| | [ ] Whole words only
| | [ ] Case sensitive replace
| | [X] Prompt on replace
| | [ ] Skip prompt if identical
| | [ ] First only
| | [X] Extract matches
| | Maximum text buffer size 4096
| |
| +--Capture to variable @pubdate
| Reset: 1
|
|--T-Filter
| |
| |--EasyPattern [[ emailaddress ]] with [$0]
| | [ ] Match case
| | [ ] Whole words only
| | [ ] Case sensitive replace
| | [X] Prompt on replace
| | [ ] Skip prompt if identical
| | [ ] First only
| | [X] Extract matches
| | Maximum text buffer size 4096
| |
| +--Capture to variable @pubemail
| Reset: 1
|
|--Remove all
|
|--Insert lines at line 1 [@pubdate, @pubemail, @inputfilename]
|
+--Output to file(s)
[ ] Only update date on changed files
[ ] Append mode
[ ] Change extension to: .txt
[ ] Open output file
Only output modified files Backup mode [ ] Remove empty output files
Re: Please No carriage return after global variable
Posted: Tue Jul 28, 2009 3:09 am
by dnsm24
I am sorry if I am being stupid here, but I assume from your reply (the filter above) that Replace/Find EasyPattern passes on any found matches to a global variable as defined in the following Capture to variable????
If my understanding of your reply is correct I cannot get it to work i.e., no data is assigned to any of the global variables I care to try (and this makes sense because there is no reference to this functionality in the help files).
Please can you clarify.
Re: Please No carriage return after global variable
Posted: Tue Jul 28, 2009 9:10 am
by DataMystic Support
There must be something wrong with your filter list - please paste it in here - or attach it.
Under each search/replace type (including Easy Pattern match), it says
The replacement text is passed to any sub filters.
Re: Please No carriage return after global variable
Posted: Tue Jul 28, 2009 10:22 am
by dnsm24
My mistake... it does work.
Many thanks
David