Please No carriage return after global variable

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

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

Please No carriage return after global variable

Postby dnsm24 » Mon Jul 27, 2009 6:21 am

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: 2164
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Please No carriage return after global variable

Postby DataMystic Support » Mon Jul 27, 2009 9:18 am

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).
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

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

Re: Please No carriage return after global variable

Postby dnsm24 » Mon Jul 27, 2009 9:51 am

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: 2164
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Please No carriage return after global variable

Postby DataMystic Support » Mon Jul 27, 2009 10:51 am

Thanks - could you also upload the filter here and include sample data in the trial run area?
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

User avatar
DataMystic Support
Site Admin
Posts: 2164
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Please No carriage return after global variable

Postby DataMystic Support » Mon Jul 27, 2009 11:00 am

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.
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

User avatar
DataMystic Support
Site Admin
Posts: 2164
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Please No carriage return after global variable

Postby DataMystic Support » Mon Jul 27, 2009 8:33 pm

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   
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

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

Re: Please No carriage return after global variable

Postby dnsm24 » Tue Jul 28, 2009 3:09 am

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: 2164
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Please No carriage return after global variable

Postby DataMystic Support » Tue Jul 28, 2009 9:10 am

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.
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

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

Re: Please No carriage return after global variable

Postby dnsm24 » Tue Jul 28, 2009 10:22 am

My mistake... it does work.

Many thanks
David


Return to “TextPipe Tips and Tricks, Questions and Support”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest