vendredi 16 juillet 2021

eprime/vba highest value of 4 attributes

I'm using eprime (psychology software tools) to design an experiment. Within that experiment, I have 4 variables/attributes with certain values and I want to highlight the highest value out of those 4 with a rectangular. I came up with the following code, which sets the coordinates as a function of the highest of 4 values. It does work for a few simple cases:

If SubjTotal1 > CoSave1 And SubjTotal1 > CoSave2 And SubjTotal1>SubjTotal2 Then 
 c.setAttrib "xcoord", 785
 c.setAttrib "ycoord", 375
 c.setAttrib "border" , 10
ElseIf SubjTotal2 > CoSave1 And SubjTotal2 > CoSave2 And SubjTotal2 > 
SubjTotal1 Then  
 c.setAttrib "xcoord", 1480
 c.setAttrib "ycoord", 375
 c.setAttrib "border" , 10
ElseIf CoSave2 > CoSave1 And CoSave2 > SubjTotal1 And CoSave2 > 
SubjTotal2 Then  
 c.setAttrib "xcoord", 1730
 c.setAttrib "ycoord", 375
 c.setAttrib "border" , 10
Else
 c.setAttrib "xcoord", 1730
 c.setAttrib "ycoord", 375
 c.setAttrib "border" , 0
End If

However, these conditions obviously do not work for all cases, e.g. where values equal and so on. All outcomes of value-rank-relationships are possible, the could all equal, some of them could be equal while there is an individual maximum value and so on and so forth. Thus, I actually need a smart if-statement or loop or something like that telling eprime to look for the highest of these values - if there is one - and if not, to omit highlighting. Any suggestions are more than welcome.

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire