Please No carriage return after global variable

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
dnsm24
Posts: 4
Joined: Mon Jul 27, 2009 4:26 am

Please No carriage return after global variable

Post 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
Last edited by dnsm24 on Mon Jul 27, 2009 6:44 am, edited 1 time in total.
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Please No carriage return after global variable

Post 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).
dnsm24
Posts: 4
Joined: Mon Jul 27, 2009 4:26 am

Re: Please No carriage return after global variable

Post 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
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Please No carriage return after global variable

Post by DataMystic Support »

Thanks - could you also upload the filter here and include sample data in the trial run area?
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Please No carriage return after global variable

Post 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.
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Please No carriage return after global variable

Post 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    
dnsm24
Posts: 4
Joined: Mon Jul 27, 2009 4:26 am

Re: Please No carriage return after global variable

Post 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.
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Please No carriage return after global variable

Post 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.
dnsm24
Posts: 4
Joined: Mon Jul 27, 2009 4:26 am

Re: Please No carriage return after global variable

Post by dnsm24 »

My mistake... it does work.

Many thanks
David
Post Reply