Referring to the attached JPG, I am trying to to do two things:
1) Add numeric columns to a collection (no matter what I have tried they always show up as text)
2) Filter by the GrpAll column
I created columns GrpCol, GrpFst and GrpMat and set them = 1 (not "1") when the respective Color, Fastener and/or Material is selected from a checkbox. I also set them to = 0 when the respective box is unchecked. I then created the GrpAll column by taking the average of these three columns (I am doing all of this to set up subsequent filtering).
As you can see, it is working up to this point, but as soon as I filter the GrpAll, the fractions all turn to 1, thus defeating the purpose. Also, oddly if I filter by any of the other three "Grp" columns, some fo the GrpAll fractions flip to 1 and some do not (ex. some 0.3333 remain 0.3333, but some change to 1).
1) Can you explain a bit more about how you are doing the calculation that gets added to the collection? I was able to setup a static collection with numeric fields and had no issues. I suspect there is some interaction between the way you are calculating and saving the values that is causing the problem.
2) Rather than working with the averages why not just Sum the columns? The ranking would be the same, but then you are working with integers not whole number fractions. If the issue is rounding then that would no longer be an issue.
But I suspect the issue is inolved with the Checkboxes. Those generate a true false value that can be interpreted as 1/0, but it isn't actually the same as an integer.
------------------------------------------------------------------------- If I have answered your question, please mark your post as Solved. If you like my response, please give it a Thumbs Up.
Following is the formula that adds the GrpAll column. I had changed to sum vs average shortly after my original post for the reasons you mention. I have been trying to use Value() everywhere possible in the hopes everything would remain numeric.
Following is how I am adding the other "GrpXXX" columns via the OnCheck and OnUncheck for each checkbox:
(for OnUncheck, Value(1) is Value (""). I just added "Value" a few minutes ago hoping to "force" numeric. Previously they were simply 1 and "" (the one was without quotes). Now that I am summing, I will try changing the "" back to 0. Not sure that will help in any way.
I have a Data Table being populated by the CollJak collection so I can see how things are working. If I use either of the following in the Items property of the table, it will filter as expected.
Of course, GrpAll could be 0,1,2 or 3 depedning on what (if any) checkboxes are selected, so I ultimately need to filter GrpAll by that column's maximum value. I have tried MAX() several different ways, but can't seem to figure it out. At this point, I am getting myself wrapped around the axle I think.