Is there any way in EPDM to find the max value from an array of variables?

I want to use a weighted rating system for checkboxes.

I need to be able to determine the highest point value of the checked boxes, as well as the total of all the checkboxes on the card.

e.g. say I have 5 checkboxes with the following point values:

*chk1*=1 point

*chk2*=1 point

*chk3*=2 point

*chk4*=2 point

*chk5*=3 point

So if the user were to check:

*chk1* and *chk5*

Then the max value=3 and total=6

Or, if the user were to check:

*chk1, **chk2, *and* chk3*

Then the max value =2 and the total = 4

Hope that makes sense.

My first thought is that I can tie the checkbox to a non-visible editbox and use control logic to set the point values.

e.g. *if *chk1 = 0 *then * edit1=0

*if *chk1 = 1 *then * edit1=1

*if *chk2 = 0 *then * edit2=0

*if *chk2 = 1 *then * edit2=1

*if *chk3 = 0 *then * edit3=0

*if *chk3 = 1 *then * edit3=2

* etc. *

I could then get the total using an input formula on another editbox and adding all the variables...but what I can't figure out is how to determine the max value??

There doesn't seem to be any support for this in the mathematical operators available.

Hey Steve,

This is why I love the forums, always good for a challenge! So the key here is Aliases:

2015 SOLIDWORKS Enterprise PDM Help - Using Input Formula Aliases

This will allow you to set the weights of each check box. I used variables Check1, Check2, ..., Check5 with the weights 1,2,3,4,5. So for the total box I used the input formula:

$Add($Add($Add($Add(%Check1(1=1, 0=0)%,%Check2(1=2, 0=0)%),%Check3(1=3, 0=0)%),%Check4(1=4, 0=0)%),%Check5(1=5, 0=0)%)

And for the max formula I had to get a bit tricky. I used the string function $Left to take the first character in a string composed of weights, but instead of 0 for unchecked boxes I used the empty string. This will work as long as weights don't exceed 1 character.

$Left(%check5(1=5, 0=)%%check4(1=4, 0=)%%check3(1=3, 0=)%%check2(1=2, 0=)%%check1(1=1, 0=)%,1)

If you need 2 characters (we'll say there's a check10 for example) you can add that like so:

$Left(%check10(1=10, 0=)%$Left(%check5(1=5, 0=)%%check4(1=4, 0=)%%check3(1=3, 0=)%%check2(1=2, 0=)%%check1(1=1, 0=)%,1),2)

I've attached an example card