Check is same or not

I have three different fields like name address phone number.

We need to compare three fields with other three fields (name 1,addrss1, phone number 1)
If name<> name1, address<>address 1, phone number<>phone number 1

Throw exception

But if any of the field has null value

For example: if name and name1 is null other two are different throw BE
Iflif name and name1 , address and address1 is null other two are different
throw BE

Hi @sruthesanju

If (name Is Nothing AndAlso name1 Is Nothing) AndAlso (address <> address1 OrElse phoneNumber <> phoneNumber1) Then
    Throw New BusinessRuleException("Fields are different where name fields are null.")
ElseIf (name Is Nothing AndAlso name1 Is Nothing) AndAlso (address Is Nothing AndAlso address1 Is Nothing) AndAlso phoneNumber <> phoneNumber1 Then
    Throw New BusinessRuleException("Fields are different where name and address fields are null.")
ElseIf (name <> name1 OrElse address <> address1 OrElse phoneNumber <> phoneNumber1) Then
    Throw New BusinessRuleException("Fields are different.")
End If

Regards,

@sruthesanju,

Try these conditions in else if

Start
|
If (String.IsNullOrEmpty(name) AndAlso String.IsNullOrEmpty(name1) AndAlso (address <> address1 OrElse phoneNumber <> phoneNumber1))
|-- True: Throw BusinessRuleException("Name fields are null but other fields are different.")
|-- False: Proceed to next If condition
|
If (String.IsNullOrEmpty(name) AndAlso String.IsNullOrEmpty(name1) AndAlso String.IsNullOrEmpty(address) AndAlso String.IsNullOrEmpty(address1) AndAlso (phoneNumber <> phoneNumber1))
|-- True: Throw BusinessRuleException("Name and Address fields are null but Phone Numbers are different.")
|-- False: Proceed to next If condition
|
If ((Not String.IsNullOrEmpty(name) AndAlso name <> name1) OrElse (Not String.IsNullOrEmpty(address) AndAlso address <> address1) OrElse (Not String.IsNullOrEmpty(phoneNumber) AndAlso phoneNumber <> phoneNumber1))
|-- True: Throw BusinessRuleException("One or more fields differ from their corresponding fields.")
|-- False: Continue Workflow
|
End

Thanks,
Ashok :slight_smile:

Like this I have 7 more fields to check whether any short scenario or only if condition is there

Hi, @sruthesanju

Fallow the next steps below:

Step 1
The image shows a sequence of operations in an automation workflow, where multiple variables are being assigned values, followed by concatenating these variables into a single variable. (Captioned by AI)

Step 2
The image shows a workflow for assigning and concatenating values, where name, address, and phone number fields are assigned specific values and then concatenated into a single field "allFields1". (Captioned by AI)

Step 3
This image shows a conditional "If" syntax in a programming workflow, displaying "Check is same" when the condition is true, and "Check is NOT same. One of the fields is null" when false, followed by a write line action to "Launch your business exception here." (Captioned by AI)