• Resolved tosh11formula

    (@tosh11formula)


    Hi

    is this possible that the results in calculated field will be max by 30 only? and once reached 30.01 will have an prompt message that the field is only max 30?

    here’s my code
    IF(AND(fieldname2<=999,fieldname6<=999,fieldname7<=999),PREC(fieldname2fieldname6fieldname7/1000000, 2), '')

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @tosh11formula

    I don’t what you tried to implement with the following piece of code:

    fieldname2fieldname6fieldname7/1000000

    If you want to calculate the product between fieldname2, fieldname6, and fieldname7, the correct would be:

    fieldname2*fieldname6*fieldname7/1000000

    You could implement the equation as follows:

    (function(){
    var result = fieldname2*fieldname6*fieldname7/1000000;
    if(30<result) return 'Your message here';
    return PREC(result,2);
    })()

    Best regards.

    Thread Starter tosh11formula

    (@tosh11formula)

    Great, it is also possible to min of 5 and max 30?

    if(5>result) return 'Minimum 5', else if(30<result) return 'Max 30';

    Plugin Author codepeople

    (@codepeople)

    Hello @tosh11formula

    Yes, of course:

    (function(){
    var result = fieldname2*fieldname6*fieldname7/1000000;
    if(result<5) return 'Your min value message';
    if(30<result) return 'Your max value message';
    return PREC(result,2);
    })()

    Best regards.

    Thread Starter tosh11formula

    (@tosh11formula)

    Hi @codepeople 

    Code Works

    but I have a problem with other result, instead of 9,500 it become 95

    still possible the default is 9,500

    ROUND(IF(fieldname8, fieldname8*9500, 9500))

    Plugin Author codepeople

    (@codepeople)

    Hello @tosh11formula

    Please enter the default value in the same format as the field’s settings.

    For example, if the default value of the hypothetical number field is 9,500, you must configure the field as follows:

    * Format: number
    * Decimal separator symbol: .
    * Thousand grouping symbol: ,

    The plugin can misinterpret values if the default value does not comply with the field’s settings.

    Other controls include similar attributes (Number, Currency, Calculated Fields). In other fields, you must enter the numbers with valid script format (without comma separator): 9500

    Best regards.

    Thread Starter tosh11formula

    (@tosh11formula)

    Hi @codepeople ,

    It works already,

    One thing is there a chance that return message will be like this error message instead of showing error in fields?

    here’s my code

    (function(){
    var result = fieldname8*9500;
    if(284910<result) alert 'Error Message';
    return PREC(result,2);
    })()

    Plugin Author codepeople

    (@codepeople)

    Hello @tosh11formula

    In this case, please follow the steps below:

    1. Enter the number 5 through min attribute in the calculated field settings.
    2. And enter the number 30 through its max attribute.
    3. Edit the equation as follows:
    PREC(fieldname8*9500,2);

    Finally, insert an “HTML Content” field in the form, and enter the following piece of code as its content:

    
    <script>
    jQuery(document).on('change', '.cff-calculated-field input', function(){jQuery(this).valid();});
    </script>

    Best regards.

    Thread Starter tosh11formula

    (@tosh11formula)

    Hi @codepeople

    It’s working!

    thank you for your help!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Calculated field max value’ is closed to new replies.