Hi, I have excel where I have multiple columns, Now I am reading data from each column and feeding into the App.
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
You can use if condition where condition is Not String.IsNullOrEmpty(row(“CustName”).toString)
then Proceed with the process else end the process
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
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.
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
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
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
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.
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)
Hope this would help resolve this
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!
May I know what was the issue we were facing or how the sequence was used
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.
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
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
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 :
You will get all empty values
You will get all data values
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.