Missing field in the excel column

Hi, I have excel where I have multiple columns, Now I am reading data from each column and feeding into the App.

Now for column suppose column Name CustName I need to check if CustName is not missing then send email. means the data from the CustName. then send email to end user.
@Palaniyappan @HareeshMR

1 Like

The same for each row will help @balkishan

use a if condition as row(“CustName”).tostring <> String.Empty , if not null, do the process in THEN , else send mail in ELSE

1 Like

Hi,

You can use if condition where condition is Not String.IsNullOrEmpty(row(“CustName”).toString)
then Proceed with the process else end the process

1 Like

Thanks for the quick reply.
so this condition I can use in the inside the for each loop in beggning only right. so I want basically stop process process also after sending the email.? I don’t want my loop will itirate again.

Yeah, use it in the beginning and then use a break activity to break the loop @balkishan

That will stop looping and then it will execute next steps

1 Like

Like this?? image

Basically I want to use this condition in Try Catch, How can I use this condition in Try like Once the CustName is found Null in the Try then It go to the Catch Part and send email and Stop the process.

@Abisha

If you need to loop through all the values and send mails to that particular ID if the name is empty, then use TRY CATCH else go for IF condition @balkishan

But anything is fine. But not sure if you place break condition in CATCH will stop the looping

1 Like

If I put the whole For Each loop process in Try and In Catch filed simply send a email Is enough, Then we don’t need to use any condition in the For Each Loop in Try Block. ?? Right me if I am wrong.

Will try block understand Only the CustName value is null then go to the Catch and send the email??? Please right me

Instead of Breaking the condition directly you can use send email activity inside else condition and break the condition

1 Like

That I understand bro, Just want to know can I use the same condition in Try Catch Activity??

Nothing will happen here @balkishan, instead of this, inside for each row, use try catch to process which will help you to know if the value is null. Ofcourse try catch surrouding the for each will also help you. If the loop fails, it will automatically come to catch block . Just try both and use the one you found efficient. I hope both will solves the purpose

1 Like

Once you give break it will break the condition and it will come out of condition, it will not go to your catch block, because you have already given a condition to either process or break.

Exactly
Usually to get out of the loop and at the same time if we want to send a mail on such exception
Then keep the whole sequence inside the TRY block of try catch h activity and no need of BREAK activity
If any exception occurs it will go to exception block I.e., Catch block where we. An include a email like that it got failed As the cyst and column has no value in it
So even no need of If condition to validate the column value like String.IsNullOrEmpty(row(“Custname”).ToString)
Not needed

Hope this would help resolve this
Cheers @balkishan

1 Like

Hi @HareeshMR I tired it’s not working. It’s keep running.
If you want I can share you the sample workflow also.

Not working bro, tried!

1 Like

Fine
May I know what was the issue we were facing or how the sequence was used
Cheers @balkishan

1 Like

see this is the sample workflow, I am reading this and feeding the data into App. If I found the CustName is null then email and Stop the process.
image

1 Like

Hope these steps would help you resolve this
—use a excel application scope and pass the file path as input
—inside the scope use a read range activity and get the output with a variable of type datatable named dt
—the use a for each row loop and pass the above variable dt as input
—inside the scope use a IF condition and mention like this
String.IsNullOrEmpty(row(“CustName”).ToString)
If true it will go to THEN part where we can use a SEND OUTLOOK MAIL ACTIVITY
Followed by that use a BREAK activity inside the THEN part so that if the sequence gets into this TEN part it will send a mail and break from the loop as well

Or if not it will continue with the ELSE part

Kindly try this and let know for any queries or clarification
Cheers @balkishan

1 Like

Assing a new string Like:

Always read Columns like 0,1,2,3…

YourString=row(2).toString --> this will read your column CustName

Now use IF :

String.IsNullOrEmpty(YourString)

Then

You will get all empty values

Else

You will get all data values

:slight_smile:

1 Like

It will work definitely Palani, But I want to use in the Try Catch block this same condition. Would it be possible. Like in try we are feeding and checking the data, In Catch if the CustName is null then it will come into the Catch block and send the email and stop the further process.

1 Like