email parsing automation

Email Parser

Extract data from emails and automate your workflow

The forum is now read only. Please, go to the the main Email Parser website if you need help.
Need help configuring the program? Have any questions regarding its use?
Hi
Is it possible to create a loop in the script based parser to parse through numerous lines?

A sample of the data I have to parse is:
11200|499.00|2880.00|31/10/2011|2880.00|0.35
11201|529.00|1440.00|31/10/2011|1440.00|0.39
11202|65.00|2304.00|31/10/2011|2304.00|0.37

I have a script that can work through the first line nicely, but can I loop through the rest of the lines? There will be an untold amount of lines.. generally 10-20 but occasionally it goes into 5 figures!

BTW:
This is actually a CSV file attachment that I receive via email - so another hurdle I have is how to get the contents from the CSV into the email body (or pleeease can EmailParser append (csv,txt,doc etc) attachment contents into the email body? ;))

Thanks :D
Hi,

Maybe something like this can help you a little... (I know, it's simple, but it works):

[syntax=csharp]
// Break the string "mydata" into pieces:
string mydata = "11200|499.00|2880.00|31/10/2011|2880.00|0.35";
char[] valid_word_separators = new char[] {'|'};
string[] pieces = mydata.Split(valid_word_separators);

//Now you have an array "pieces" with the content.
//Iterate through the array to get your data.

int n=0;
string piece_1 = "";
string piece_2 = "";
string piece_3 = "";

foreach(string piece in pieces)
{
// Do whatever you want with a piece...
if (n==0) piece_1 = piece;
if (n==1) piece_2 = piece;
if (n==2) piece_3 = piece;
// etc...
n=n+1;
}
[/syntax]
By the way, you can also split your data 'block' with \n of \r as the separator.
I guess this would give you an array with datalines in it.