If Match Activities output = empty

Hi. I wan to do this.

If match activities output = empty(Null)
-match_output = " "

how can I do that ?

1 Like

Hi @sufyant

use String.IsNullorEmpty(match_output) or string.isNulloremptyWhitespace(match_output)

Thanks
Ashwin S

1 Like

HI
this can be done with a ASSIGN activity like this
str_output = IF(String.IsNullOrEmpty(str_input.ToString)," ",str_Input.ToString).ToString

Cheers @sufyant

1 Like

Not working

1 Like

May i know the issue and the value passed in as iput and the expected output
@sufyant

1 Like

Buddy how can I write this in ASSIGN Activity

1 Like

simple buddy
stroutput in TO property and this expression
IF(String.IsNullOrEmpty(str_input.ToString)," ",str_Input.ToString).ToString

in VALUE property of ASSIGN activity

Cheers @sufyant

1 Like

like that ?

1 Like

Hi @sufyant

Check this

Match_output.ToString.contains(string.empty)

Thanks
Ashwin S

1 Like

in value part
only this

Cheers @sufyant

1 Like

Hi @sufyant

How about “” instead of string.empty

Thanks
Ashwin S

1 Like

no its same error

What is the output of Matches
Try to print it
After that ,
Match_Output.Tostring.Trim.Contains("")

1 Like

Buddy I think this is not for me. I am getting e-mail address from e-mail body with match activities. I wan to do this

If in mail body contain e-mail address, mailAddress = mailMatches(0).Value
Else mailAddress = " "

d’you know what i mean?

1 Like

Got it
but only for mailMatches(0).Value that is for first match alone or for all matches
@sufyant

1 Like

just first matches. Because only 1 mail address have in mail

1 Like

Fine
hope these steps would help you resolve this
–get the output from matches activity with a variable named mailMatches
–now use FOR EACH activity and pass the variable mailMatches as input and change the type argument as System.Text.RegularExpressions.Match
–inside the loop use a IF condition like this
String.IsNullOrEmpty(item.ToString)
if true it goes to THEN part where use a assign activity like this
mailAddress = " "
or goes to ELSE part where use ASSIGN activity like this
mailAddress = item.ToString

–next to this IF use a BREAK activity

Cheers @sufyant

2 Likes

Like that buddy ? @Palaniyappan

Where should I add break activity?

2 Likes

next to this IF condition within FOR EACH loop
@sufyant

2 Likes