Condition of exception

If(TransactionItem IsNot Nothing,Not(String.IsNullOrEmpty(TransactionItem(“Status”).ToString.Trim)),False)

this is my condition, I want to add that if the status column has an exception then that case is run by the bot

give a try on

isNothing(TransactionItem) OrElse String.IsNullOrEmpty(TransactionItem(“Status”).ToString.Trim)

gives true when null or empty

Feel free to negate it with surrounding Not
Not ( isNothing(TransactionItem) OrElse String.IsNullOrEmpty(TransactionItem(“Status”).ToString.Trim) )

we assume that it is JSON or others and that not the Property Status was targeted

i want to add condtion that, if my status column is empty and expection, then that perticular case is run.

was just a rewrite of your if method
had you tried?

sound also like a datarow, then we can do:
isNothing(TransactionItem("Status")) OrElse String.IsNullOrEmpty(TransactionItem(“Status”).ToString.Trim)

gives true when null or empty

Hi @ashishmani ,

Is this you want in switch condition ?

If so follow below post

Also please share screenshot where exactly you are using this condition ?

i try this one but still it not pick the excption cases

we hope you recognized that you have to negate or to swap the branches

IsNothing(TransactionItem(“Status”)) OrElse String.IsNullOrEmpty(TransactionItem(“Status”).ToString.Trim)
cannonot simulate in immediaet panel but similar to

I think you might be asking to check the words in the Status, then perform different steps based on that. Is that true?

Let’s assume a status says this as an example:
“Exception: Line Item Not Found”

You would use that string in a Switch then with ‘String’ set as the type in properties
Ex:

Switch activity, condition: TransactionItem("Status").ToString.Trim
  Case 1: Exception: Line Item Not Found
       <steps for this case>

And, place this inside an IF activity so you can check that the value is not null

You can additionally add .Contains() or remove case-sensitivity by using the method someone linked in previous post where you use embedded IF statements.

So in the end, you would have something like this:

IF Activity: condition: TransactionItem isNot Nothing AndAlso Not String.IsNullOrEmpty(TransactionItem("Status").ToString.Trim)
  Switch Activity: condition: IF(TransactionItem("Status").ToString.ToUpper.Contains("LINE ITEM NOT FOUND"), "NOT FOUND", "Default")
    Case 1: NOT FOUND
        <steps for Not Found case>

And add cases for each exception message which you want to perform different steps for.

I hope this helps and gets you closer to solving.

EDIT: added “Not” to condition that checks if it’s null

Regards.

In addition to my previous reply,
If you only want to check that an exception exists, then simply use an IF, and not a Switch

Ex:
Status = “Exception: Line Item Not Found”

IF Activity: condition: TransactionItem isNot Nothing AndAlso Not String.IsNullOrEmpty(TransactionItem("Status").ToString.Trim) AndAlso TransactionItem("Status").ToString.ToUpper.Contains("EXCEPTION")
  <steps to perform>

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