Dynamically pass multi-select values to a chart/gauge criteria; Or, get sum total of multiple counts from a for each loop
I want to use a multi-select field in a form to dynamically show results in a gauge/chart/graph. I would assume that when passing the multi-select values to the page variable, the page variable should be of type Collection..? When I try to set my gauge criteria to field is equal to (or contains) page variable, I get a mismatched data type error. And setting the page variable as type Text doesn't work either - the gauge criteria accepts it, but it's not translating the data right for this purpose - with each click of the multi-select boxes each box just cancels out the previous box clicked rather than adding the values together. I got to thinking that this isn't possible to do in this way, but I could do the math in a workflow of the form and just pass the final number to the page variable/gauge. But I can't quite wrap my head around getting that total. So far, I'm using a for each loop to get a count on each selection in the multi-select; but how do I add those counts together to get the total? This is what I've got:
for each selection in input.Multi_Select
{
typeCount = inventoryForm[auctionType == selection].count();
}
What comes next?