Comparing 2 multiple-selection list boxes looking for identical values. - InfoPath Dev
in

InfoPath Dev

Comparing 2 multiple-selection list boxes looking for identical values.

Last post 01-10-2014 07:17 AM by Kishan Srivastava. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 10-21-2009 09:05 AM

    Comparing 2 multiple-selection list boxes looking for identical values.

    This is more of a pipe dream than anything else, but I'll ask anyways!

    I have 2 multi-selection list boxes containing identical items. 

    For example.  Listbox1 contains 10 items (numbers 1-10), as does ListBox2.    In Listbox 1... the numbers 1,2,3 are selected. In listbox2, only numbers 1 and 2 are selected.

    Are they any code-less solutions to compare the 2 listboxes?  I'd like to know what instances appear in both listboxes (1 & 2) and hopefully, the differences.  (the #3 appears in Listbox 2, but not in Listbox 1)

    I doubt I can do this without coding... but maybe someone can share some good news with me!

    Thanks in advance.

     

  • 10-21-2009 09:19 AM In reply to

    Re: Comparing 2 multiple-selection list boxes looking for identical values.

     If it's simply for display purposes (i.e. you're not storing the intersected list somewhere in the data source), then this is possible without code.

     Make a repeating table/section bound to the same field as listbox 1 and set the conditional formatting:

    Expression: not(path to field for listbox 2[. = current()])

    Behavior: hide this control

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 10-21-2009 10:27 AM In reply to

    Re: Comparing 2 multiple-selection list boxes looking for identical values.

    Thanks JImmy.

    I just want a count of the intersected items.  So if 2 items show up in both lists, a field value is set as 2.

    You are saying this can only be accomplished with code correct?

  • 10-21-2009 03:19 PM In reply to

    Re: Comparing 2 multiple-selection list boxes looking for identical values.

    The formula is:

     count(full path to listbox1's field[. = full path to listbox 2's field])

    so if my first listbox is bound to field2 and my second listbox is field4, the formula would be:

     count(/my:myFields/my:group1/my:field2[. = /my:myFields/my:group1/my:field4])

    I'll let you experiment around with any rules/default values for copying this value to a field.  Remember that there's also the option of displaying the formula's value in an expression box.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 10-22-2009 06:01 AM In reply to

    Re: Comparing 2 multiple-selection list boxes looking for identical values.

    Hey Jimmy,

    Thank you again for all of your help!  This works like a charm.  I have to say the multi-select boxes are definitely quirky and you have been a tremendous help.

    Have a great one.

  • 01-10-2014 07:17 AM In reply to

    Re: Comparing 2 multiple-selection list boxes looking for identical values.

    Hey , I have the same kind of requirement. Scenario is : I have 2 multiple list boxes 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. Regards Kishan
    Kishan Srivastav
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.