Global Variables?

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

JSMediRegs
Posts: 2
Joined: Sat Feb 10, 2007 5:31 am
Location: Wellesley, MA U.S.A.
Contact:

Global Variables?

Postby JSMediRegs » Sat Feb 10, 2007 5:36 am

I'm having major time trouble trying to figure out how to get a global variable declared. I have a bit of code which I've successfully translated into a local variable (confined to one filter) which I then need to use somewhere else... How?

here's my code for an easy pattern search and replace

search:

Code: Select all

<P CLASS="art-head2">
[ capture( 1+ digits or letters or whitespace or '>' or <!"#$%&'()*+,-./\:;=?@[]^_`{}~|<> )]</P>

replace:

Code: Select all

</doc>
<doc>
<link rel="stylesheet" type="text/css" href="/states.css">
:::uid @inputFilename
:::index @inputFilename
:::date @date
<br><p class ="heading3">$1</p>


From there, I'd like to stop $1 into a global variable... how do I go about doing that?

Thanks!
~Jon
jschwartz@mediregs.com

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

Postby DataMystic Support » Mon Feb 12, 2007 10:03 am

Hi Jon,

Code: Select all

<P CLASS="art-head2">
[ capture( 1+ digits or letters or whitespace or '>' or <!"#$%&'()*+,-./\:;=?@[]^_`{}~|<> ) as 'globalvarname' ]</P>


Remember though - you may need to place this pattern inside a restriction - otherwise TP may only give you the value of the LAST occurrence of this variable. Remember - TextPipe acts like each filter processes the ENTIRE file before passing it on - unless you restrict to a small area of text.
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

JSMediRegs
Posts: 2
Joined: Sat Feb 10, 2007 5:31 am
Location: Wellesley, MA U.S.A.
Contact:

Postby JSMediRegs » Wed Feb 14, 2007 8:07 am

Ok so now I have it in a restrict to pattern filter which says this

Code: Select all

<P CLASS="art-head2">
[ capture ( 1+ digits or letters or whitespace or <!"#$%&'()*+,-./\:;=?@[]^_`{}~|> ) as 'title1' ]</P>

with the action set to send matching text to sub filter.

In the subfilters, I am using EasyPattern search and replaces on what I believe to be the text found in that restrict filter, right? I am also trying to use the global variable @title1

The only thing I can get it to output when I use the @title1 variable in a subfilter is "1" I know that "1" is not the right answer. What am I doing wrong?

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

Postby DataMystic Support » Wed Feb 14, 2007 8:38 am

Numbers cannot be used as global variable names. What you're seeing for @title1 is
<blank>1

You can't use a global var in the search field, only the replace field.

If you email your filter to us we can help further.
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


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

Who is online

Users browsing this forum: Exabot [Bot] and 5 guests