Calculated field; add minimum or maximum | XM Community
Question

Calculated field; add minimum or maximum

  • 27 June 2023
  • 1 reply
  • 73 views

Badge +2

Hi,

I would like to code up the following:

 

Embedded data fields:

wage_1_1 = 1

wage_2_1 = 9

 

Page shown to participant:

Minimum: 1

Maximum: 9

 

Code on Qualtrics:

Minimum: $e{ min( e://Field/wage_1_1 , e://Field/wage_2_1 ) }

Maximum: $e{ min( e://Field/wage_1_1 , e://Field/wage_2_1 ) }

 

However, right now, this is shown to the participant:

Minimum: {Invalid Expression}

Maximum: {Invalid Expression}

 

Does anybody know how to code this? (Ideally not with javascript since that seems to not work on my account for some reason).

 

Thank you for your time and suggestions!


1 reply

Userlevel 4
Badge +16

Hello @cella80.

As far as I understand, there’s no math operation to identify min or max. here you can see the available operations. 

Yo could give it a try to the JS and try to replicate what they talked on this discussion and talk to your brand admin to activate the JS permision on your user. 

Otherwise, you could try to do that definition in the survey flow with something like this: 

Here, you would be doing three things: 

  1. Declaring your two variables (Dato1 and Dato2) and assigning values to them
  2. The second embedded data block assumes that the minimum data is Dato1 and the maximum is Dato2. 
  3. The Branch evaluates the opossite hypothesis to finally determine which one is bigger. 

Clearly this approach would work this way with only two variables. In case that you have more than 2 it would get more complicated so I would consider using JS. 

 

Best regards :) 

Leave a Reply