Logic, If, variable

Hello All,

Good day,

I have 2 variables holding the below values,

out_HF_Accepted_Codes = K51.90,C78.6
IcCodes = K51.90, C78.6, K12.850

How to compare both and get the unique value of K12.850 separately in UiPath

I need to provide an output as out_HF_Accepted_Codes = K21.850

Thanks is Advance

@manikandan.murugan,

Try with the below code, that will give the expected result.

String.Join(",", out_HF_Accepted_Codes.Split(","c).Except(IcCodes.Split(","c)))

Note: Not tested

Hi @manikandan.murugan

Assign activity -> out_HF_Accepted_Codes = {"K51.90","C78.6"}
out_HF_Accepted_Codes is of DataType Array(System.String)

Assign activity -> IcCodes = {"K51.90", "C78.6", "K12.850"}
IcCodes is of DataType Array(System.String)

Assign activity -> Output = String.Join(",",IcCodes.Except(out_HF_Accepted_Codes).ToArray())

Regards

Hi @manikandan.murugan

Regards

1 Like

Hi @manikandan.murugan
please try with below vb.net code

Dim out_HF_Accepted_Codes As String = “K51.90,C78.6”
Dim IcCodes As String = “K51.90,C78.6,K12.850”

’ Split the input strings into arrays
Dim out_HF_Accepted_Codes_Array As String() = out_HF_Accepted_Codes.Split(",“c)
Dim IcCodes_Array As String() = IcCodes.Split(”,"c)

’ Use LINQ to find the unique elements
Dim uniqueElements = IcCodes_Array.Except(out_HF_Accepted_Codes_Array)

’ Concatenate the unique elements into a string
Dim output As String = String.Join(“,”, uniqueElements)

hope it helps!!!

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