Page 1 of 1

Math, Global Variable and etc.

Posted: Thu Jan 18, 2007 3:16 pm
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?

Posted: Fri Jan 19, 2007 2:47 pm
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()

More details?

Posted: Fri Jan 19, 2007 7:20 pm
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.

Posted: Tue Jan 23, 2007 8:08 pm
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.