cancel
Showing results for 
Search instead for 
Did you mean: 

Report Variable logic to compare two fields and display as match or mismatch

Former Member
0 Kudos
1,901

Hi All ,

I have a scenario where in i need to compare data of two columns. Both columns are Strings.

below are the scenarios to be covered


Column1Column2output :is it a mismatch?
AAAYes
AAAYes
AAAAAC;AAA; AABNo
AAAAAANo
No


Scenario 1 : if column 1 has a value and Column 2 is NULL = its a Mismatch

Scenario2 : if column 1 is NULL and Column 2 has a Value = its a Mismatch

Scenario 3 : if column 1 has a value and its found in Coulmn 2 (any position in set of strings) =Not a Mismatch

Scenario4 : if column 1 value  matches with Column 2 value= its not a Mismatch

Scenario 5: If both columns are NULL = its not a mismatch

Note : I have tried to achieve the above scnerios by creating a report level variable and have defined as below

if (IsNull([column1)) then "Y"

else

If(Match([column1];"*[column2]*");"Y";"N")

The above logic holds good for scenario 2,3,5 but do not cover the rest

I use SAP BusinessObjects BI Platform 4.1 Support Pack 6 Patch 4

Version: 14.1.6.1848

http://www.sap.com/bi

Can anyone please assist

Thanks,

Chaithra M.R

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Niki,

Please try below.

=If Pos([Col2];[Col1])<>0 And (Not(IsNull([Col1])) And Not(IsNull([Col2]))) Then "Match" Else "No Match"

Regards

Niraj

Answers (1)

Answers (1)

former_member198519
Active Contributor
0 Kudos

Try this:

=if (IsNull([col1]) AND isnull([col2]) ) then "Not a match"

elseif (Not(IsNull([col1])) AND isnull([col2]) ) then if(Match([column1];"*[column2]*");"its a Match";"Mismatch")

elseif (IsNull([col1]) AND Not(isnull([col2])) ) then if(Match([column1];"*[column2]*");"its a Match";"Mismatch")