Need server name

Hi ALL,
I need to grep the server name WEB 27 and WEB 28 from mail body part.
I am able to get the first on but not second or third. Pls let me how can I do it
PFB the body message.

************** WEB-27 Fri Apr 26 11:50:05 IST 2019 ****************

2019-04-26 11:46 847 842
2019-04-26 11:47 866 824
2019-04-26 11:48 839 821
2019-04-26 11:49 845 835
2019-04-26 11:50 818 741

************** WEB-28 Fri Apr 26 11:50:06 IST 2019 ****************

2019-04-26 11:46 869 862
2019-04-26 11:47 866 840
2019-04-26 11:48 877 865
2019-04-26 11:49 886 870
2019-04-26 11:50 902 879

Buddy @kiranh
kindly follow the below steps buddy that could resolve your issue

  1. once you get the individual mail message from get outlook mail activity pass that mail message to a variable using assign activity like this

out_mail_body = mailmessagevariable.body.split(Environment.Newline.ToArray(), StringSplitOptions.RemoveEmptyEntries)

where this would give you the array of lines in the mail body,

2.Now use a for each loop to iterate through each line in the array by passing the out_mail_body as input and change type argument as string type in for each loop parameter.
3. inside for each loop use a if condition like
item.contains(“WEB”), if this condition gets passed
Then use a assign activity inside then part of if condition like
out_web_servername = Split(item," ")(1).ToString
Hope this would help you buddy

Kindly let know whether this works or not buddy @kiranh

Cheers

validation error on this. out_mail_body = mailmessagevariable.body.split(Environment.Newlines.ToArray(), StringSplitOptions.RemoveEmptyEntries)

Buddy @kiranh

its out_mail_body = mailmessagevariable.body.split(Environment.Newline.ToArray(), StringSplitOptions.RemoveEmptyEntries)

where out_mail_body is of type string[ ]
@kiranh

Cheers

did that error got cleared buddy… @kiranh

yes but getting output not as per expected. getting “”**************"," this I am not getting server name

{
“message”: “**************”,
“level”: “Information”,
“logType”: “User”,
“timeStamp”: “17:17:24”,
“processVersion”: “1.0.0”,

}

aaah sorry buddy like this just now i changed @kiranh

out_web_servername = Split(item," ")(1).ToString

hi buddy,

Now I am able to get the server name but also getting the blank line can we ignore it in output

1 Like

Like how buddy @kiranh

Buddy @kiranh …?

In between of WEB-27 and 28 I am getting 4-5 blank line/

1 Like

Buddy use like this @kiranh
use a for each loop
– to iterate through each line in the array by passing the
out_mail_body = mailmessagevariable.body.split(Environment.Newline.ToArray(), StringSplitOptions.RemoveEmptyEntries)
as input and change type argument as string type in for each loop parameter.
3. inside for each loop use a if condition like
item.contains(“WEB”), if this condition gets passed, we will getting the lines only with WEB not blank lines
Then use a assign activity inside then part of if condition like
out_web_servername = Split(item," ")(1).ToString

1 Like

OK got it buddy. Thanks for the solution.
I will look forward you for help

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.