oTree Forum >

How to get the {field_name}_max() and put it into a variable to use

#1 by jrm0094

Hi, I am trying to collect the dyanimic max value of one of my variables called "second_bid_forex". I am utilizing the {field_name}_max() function to create a "second_bid_forex_max()" function in my code. But I still am not able to easily get the max value for each player.

For example if player 1 has their max value of second_bid_forex set to 100, how do I collect that number to put into a variable?

Thank you for your help!

#2 by aseyq

Could you please elaborate on that? How do you plan to calculate the maximum value? Normally you'd write the maximum allowed value to a player field and then use `fieldname_max`. If it is calculated based on the current input(s) you can define `fieldname_error_message` or `error_message` functions. Then you'll have access to 'value(s)'.

Write a reply

Set forum username