Hi,
Is there any straightforward method to compare below two arrays in such a way that, SelectedAnswersArray[1]=correctAnswersArray[1] , SelectedAnswersArray[2]=correctAnswersArray[2] and SelectedAnswersArray[3]=correctAnswersArray[3] .
SelectedAnswersArray: {"a","c","b"}
correctAnswersArray: {"a","b","c"}
Discussion posts and replies are publicly visible
Did you try a simple foreach() that compares the values on both lists by index? This will get you a list of booleans.
{"a","c","b"}={"a","b","c"}
As unreal as it looks, just an equal operator will work.
Can we use foreach() inside a foreach() ?
Sure, but why would you want to do that?
oh great... Will try this approach also...
Hi, Adding to Harshit's and Stefan's comments, you can also use Appian's OOTB function 'exact', which will help you, in case you need to compare in a case-sensitive manner.a!forEach( items: merge({ "a", "B", "C" }, { "a", "b", "C" }), expression: exact(fv!item[1], fv!item[2]) )
a!forEach( items: merge({ "a", "B", "C" }, { "a", "b", "C" }), expression: exact(fv!item[1], fv!item[2]) )
Comparing two arrays returns a list of booleans. This might be a little better:
a!localVariables( local!array1: { 1, 2, 3 }, local!array2: { 1, 2, 3 }, not(contains(local!array1 = local!array2, false)) )
Hello Chithra Venkitachalam ,
You can try this as well.
a!localVariables( local!arr1:{1,2,4}, local!arr2:{1,2,3}, a!forEach( items: local!arr1, expression:fv!item=local!arr2[fv!index] ) )