I am working on Info Path . Scenario is :-

I have 2 multiple list boxes control and if the values in the 2 multiple list boxes not matching then set the text Box A value to fail and if value matches then set value Pass. I have tried getting the multiple list box value in the text box by using eval function. But its not working. Please help and give me the suggestion.



1 Answer 1


You can pull all the values of a multiple selection box into a text box with the following eval function:

eval(field1[. != ""], "..")

You need to create a rule on your multiple selection box that triggers “when this field changes” and set your text box to that eval function, this will update the text box when a user ticks a box. You also need to set this to the default value of your text box and make sure “refresh value when formula is recalculated” is ticked, this will refresh the value when the user deselects a tick box.

These text boxes will contain the selection as a string in the order they were selected.

You can then make your own rules to work out if these two fields are equal to each other.

I had a go at doing this all with 1 field and came up with an abomination of a solution, but thought I’d post it here as it might give you some idea’s if you’re stuck, or you might just be able to copy it if you’re after a quick dirty fix:

Add a rule that triggers when multiple selection box 1 (henceforth “field1”) changes. Have it set the value of your text box to:

contains(contains(contains(contains(eval(field1[. != ""], ".."), "option1"), contains(eval(field2[. != ""], ".."), "option1")), translate(contains(contains(eval(field1[. != ""], ".."), "option2"), contains(eval(field2[. != ""], ".."), "option2")), "f", "1")), translate(contains(contains(eval(field1[. != ""], ".."), "option3"), contains(eval(field2[. != ""], ".."), "option3")), "f", "1"))

Where option1, option2, option3 are the option values from your multiple selection boxes (you’ll need to edit the formula if you have more or less options) and feild2 is your second multiple selection box.

Make the same rule on your second multiple selection box, and add this giant wall of formula to the default value of your text box.

That formla checks to see if the boxes either both contain each option of both don't contain it and returns false if any of the options fail.

This is a horrible solution and I’m sure more elegant ways exist (I’m still learning IP) but it works.

If you have any questions about my solution just leave a comment :D

Good Luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.