Help with parsing a text file

Discuss RoboTask here
Post Reply
dcocke
Posts: 5
Joined: Wed Dec 15, 2004 9:43 pm
Location: United States

Help with parsing a text file

Post by dcocke »

I am assuming RoboTask can do the following, but after reading the help and searching the forum, I am unable to see the answer.
I have a text file; actually an Email message from my mail server, but it is in ascii text format.  I wish to have robotask look at the message one line at a time and pull out certain information for me and plug it into our database.
I have created a text loop and pointed to the file, then assign the current line to a variable, then I use an If Then statement to attempt to see if a certain string is contained within that line.  My If/Then options do not seem to allow for this.  If I say 'equal to' and compare it exactly to the string, then it will of course match.
A typical line in my message might look like this:
X-MDRemoteIP: 68.47.188.155
And I want to test to see if the line contains: "X-MDRemoteIP:", and if it does, then give me the value at the end of the line and assign it to a variable.
One other related question, in the If/Then comparison type options, I see equal to, not equal, equal or greater, etc.  But what does the "In (occurrence)" option mean?  I cannot see a reference to this in the documentation.  Choosing that option does not seem to help with my above issue.
Thanks in advance for your assistance.  I'm running version 2.1
 
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Help with parsing a text file

Post by Oleg »

One other related question, in the If/Then comparison type options, I see equal to, not equal, equal or greater, etc. But what does the "In (occurrence)" option mean? I cannot see a reference to this in the documentation. Choosing that option does not seem to help with my above issue.
If you compare two values as strings you have an additional comparison types: In, Is Empty, Is Not Empty.
"In (occurence)" - If first string (operand) is contained in second string at any place, then expression is True. Otherwise - false.
In your case you should use this comparison type.
And I want to test to see if the line contains: "X-MDRemoteIP:", and if it does, then give me the value at the end of the line and assign it to a variable.
In order to parse any strings on your algorithm you should use own BASIC script. Download free "Basic plugin" for RoboTask and install it.
dcocke
Posts: 5
Joined: Wed Dec 15, 2004 9:43 pm
Location: United States

Help with parsing a text file

Post by dcocke »

Oleg, thank you so much for your response.  It is working great.  My main issue was that I had my operands backwards, and thus the "In occurrence" was not working.
I was reluctant to get the Basic plugin, as I thought I would have a huge learning curve.  But seeing a few examples of how variables are passed to and from RoboTask to Basic, it was actually quite easy.  The Basic plugin also seems to have good documentation.
Thank you again.  I am so amazed at the potential of what Robo Task can do.
-David
Post Reply