Math, Global Variable and etc.

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

sergeda
Posts: 7
Joined: Thu Jan 18, 2007 3:01 pm

Math, Global Variable and etc.

Postby sergeda » Thu Jan 18, 2007 3:16 pm

Hi.
I have a price with number of lines wich looks like this:
BenQ-Siemens CF61 12 165.00 5.0900

I am trying to figure out how can I math with price (165.00 in example).
I have created Perl pattern wich extract price and in VB subfilter make a math.
Everything works except I loose all other part of line.
I have tried to save first and last part of line to global variable in VB script before doing a math and then form a result line, but no success. When debugging with message box it looks like last VB subfilter don't see my variables from other subfilters.
Can somebody help me with this?

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

Postby DataMystic Support » Fri Jan 19, 2007 2:47 pm

Its sounds like you pattern is matching the entire line, not just the price part of it. If the pattern matches just the price, then only the price will be passed to the scripting subfilter, and you won't lose the remainder of the line.

To share variables between scripting filters, use TextPipe.setGlobalVar and TextPipe.getGlobalVar()
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

sergeda
Posts: 7
Joined: Thu Jan 18, 2007 3:01 pm

More details?

Postby sergeda » Fri Jan 19, 2007 7:20 pm

Thank you for your reply.
Can you give me a bit more information.
I use pattern .*\t(.*)\.00\t.* , it is matching just the price part. In "replace with" I set $1 and tick "Extract matches". In subfilter I make a math, and then I just get a number of prices. How can I manage don't lose another parts of line and put the result of math into the line?
Also, can you give an example how to use TextPipe.setGlobalVar and TextPipe.getGlobalVar()? Or just tell me where I can read about it.

Thank you.

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

Postby DataMystic Support » Tue Jan 23, 2007 8:08 pm

Don't use Extract Matches. Use the Replce Action of Subfilter variable 1.

You can read about the TextPipe automation object in the help file.
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: No registered users and 1 guest