Math, Global Variable and etc.

Get help with installation and running here.

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

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

Math, Global Variable and etc.

Post by sergeda »

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

Post by DataMystic Support »

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()
sergeda
Posts: 7
Joined: Thu Jan 18, 2007 3:01 pm

More details?

Post by sergeda »

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

Post by DataMystic Support »

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.
Post Reply