How do I Count the Number of Selections in a Multi Select List?

I'm trying to use a combination of rules, default values, and the count() function to count how many selections a user makes from a multi select list populated from a SharePoint Data Connection. I've tried to follow this thread:
http://www.infopathdev.com/forums/t/13563.aspx 

It's not working for me. I can only get the behavior to correctly count how many have been selected after one that was selected is DE-selected.

How do I accomplish this?
LVL 1
-PolakAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Clay FoxDirector of Business IntegrationCommented:
I have never been able to use a multiselect successfully.  I would use a secondary data connection and a repeating table to have them select that way. I have found that to be much easier.
0
-PolakAuthor Commented:
Okay, even though there are 50 possible selections in the multi-select, and a user may need up to 25, I can live with going with that solution...

So now that I have a repeating table (with 3 columns) how do I count how many selections a user makes? I realize that I can count the repeating group and only place 1 field in each group; however, with up to 25 selections being made that will make my form unnecessarily long....

I've tried (in the default value of my count field):
Count(/my:myFields/my:Capability/my:MissionPartRT/my:ReqCapMissPartners/[my:testing1 = "XYZ"]

But this only counts if the user selects XYZ in  the first column/field.... what I really need is an expression that allows me to say count testing1 <> "..." + testing2 <> "..." + testing3 <>"..."
("..." being the hypothetical default value in each of the repeating fields).
However, it appears that "<>" isn't the right expression for "does not equal".

Also/Separately, kindly see my question on promoting data from repeating groups to SharePoint... basically I'm asking if there's anyway to create unique fields on SharePoint from a repeating group or if its best to just use a delimiter and handle separating the data on the analysis side....
http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/InfoPath/Q_28625225.html
0
Clay FoxDirector of Business IntegrationCommented:
You may want to add a Boolean field to your list of selections, just to make that easier.
You could then put a rule on that check box field that does a concatenation or an addition to create what you describe.  The only issue there is if they uncheck and recheck etc.  The logic to weed that out gets a bit hairy.  Not sure if you just need a count of selections or you want a list of the selections they have made.

Ultimately you want to be careful of hardcoding certain values because inevitably someone comes along and want to change a value.

Hope that helps.
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

-PolakAuthor Commented:
Okay I think I follow you... see the image to illustrate:
Here's what I did:
snip

1.

Entered  "..." as default values in testing1 and testing2

2.

Created a rule that set bootest1 = "true" if testing1 <> "..." AND a rule that set bootest2 = "true" if testing2 <> "..."

3.

went on sharepoint and added "..." as a possible Value for selection so that if a user needed to "go back" and not identify a Mission Partner they had an available selection that matched the default value.

4.

Created a rule that set bootest1 = "false" if testing1 = "..." AND a rule that set bootest2 = "false" if testing2 = "..."

5.

Set the default value of the mission owners count field equal to:
count(/my:myFields/my:Capability/my:MissionPartRT/my:ReqCapMissPartners[my:bootest1 = "true"]) + count(/my:myFields/my:Capability/my:MissionPartRT/my:ReqCapMissPartners[my:bootest2 = "true"])
That seems to cover the solution... did I understand you correctly?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Clay FoxDirector of Business IntegrationCommented:
Sure that should work.
0
-PolakAuthor Commented:
My solution is identified as the best solution as it should  should help other novice users better understand and provides a walkthrough; but, I wouldn't have gotten there without clayfox's recommendations.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
InfoPath

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.