How to write in expression editor if statement correctly

I need to check if my counter is equal to 0, if so, print what is in the body of the email, and if not, then not. I can’t figure out how to write the sentence in the correct syntax in the expression editor

image

@mironb

Take if activity

if:Counter.Equals(0)

Then
Use Assign activity

else

Hi @mironb

Use the IF condition and pass the condition in that and in the then sequence use the assign activity.

Pass the body in the body field of send outlook mail messages activity.

Regards

Hi @mironb

Initialize the counter = 0 in the code start because when the counter is 0 then only the execution goes into the then sequence and also after the IF condition give the counter increment.

Regards

Hi @mironb

Hope it helps!!

Hi @mironb
Follow Below Steps


Initialize the counter = 0
And use Counter+1 in both True and False Case.


Hope it will helps you :slight_smile:
Cheers!!

There is no way to implement this in the “body” with “if” ?
I know how to implement this with the if activity.

@mironb

This is how it would be

If(Counter.Equals(0),bodyvariable,"")

Cheers

@Anil_G
What is “bodyvariable” ?

@mironb

Use this

IF(Counter.Equals(0),CurrentItem.Body,“”)

@mironb

It is the variable containing the mailbody… as I donot know the name I gave a sample place holder you can replace with actual varible

cheers