• Resolved kna1337

    (@kna1337)


    Hello, how to make 3 characters after the decimal point.
    000.0000000000000
    000.000

    if(fieldname5>=50, fieldname5<=150, fieldname6 == ‘name55’) { fieldname1*190.3*fieldname5 }else{0}

    • This topic was modified 3 years, 4 months ago by kna1337.
Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter kna1337

    (@kna1337)

    if(fieldname5>=50, fieldname5<=150, fieldname6 == ‘name55’) { fieldname1*190.3*fieldname5 }else{0}

    Plugin Author codepeople

    (@codepeople)

    Hello @kna1337

    To get the result with three decimal places, please, use the PREC operation.

    PREC(X, Y) rounds the number X with Y decimal places.

    Your equation contains some parser errors, the correct would be:

    PREC(IF(AND(fieldname5>=50, fieldname5<=150, fieldname6 == 'name55'), fieldname1*190.3*fieldname5, 0), 3)

    Best regards.

    Thread Starter kna1337

    (@kna1337)

    thank you dude, create 2 script, good work. Please check, it’s correct?
    PREC((((fieldname2+fieldname3)*2+80)*1.035)*((fieldname3+fieldname4+10)*1.035)/1000000, 3)

    • This reply was modified 3 years, 4 months ago by kna1337.
    Plugin Author codepeople

    (@codepeople)

    Hello @kna1337

    Excellent !!! your equation is correct.

    Best regards.

    Thread Starter kna1337

    (@kna1337)

    Thank you dude, this is well ??

    Thread Starter kna1337

    (@kna1337)

    but what is correct under several conditions, otherwise the result is 0

    PREC(IF(AND(fieldname5>=50, fieldname5<=150, fieldname6 == ‘name55’), fieldname1*147.3*fieldname5, 0), 2)
    PREC(IF(AND(fieldname5>=151, fieldname5<=300, fieldname6 == ‘name56’), fieldname1*86.6*fieldname5, 0), 2)
    PREC(IF(AND(fieldname5>=301, fieldname5<=500, fieldname6 == ‘name57’), fieldname1*59.8*fieldname5, 0), 2)

    Plugin Author codepeople

    (@codepeople)

    Hello @kna1337

    I’m sorry, but your equation includes many parser errors.

    You have two alternatives: you can nest the IF operations, or you can use if conditional statements and the equation with function structure.

    By nesting the IF operations, the equations would be similar to:

    PREC(
        IF(AND(fieldname5>=50, fieldname5<=150, fieldname6 == 'name55'), 
            fieldname1*147.3*fieldname5, 
            IF(AND(fieldname5>=151, fieldname5<=300, fieldname6 == 'name56'), 
                fieldname1*86.6*fieldname5, 
                IF(AND(fieldname5>=301, fieldname5<=500, fieldname6 == 'name57'),
                    fieldname1*59.8*fieldname5, 
                    0))), 
        2)

    Using if conditional statements and function structure:

    PREC((function(){
        if(AND(fieldname5>=50, fieldname5<=150, fieldname6 == 'name55')) 
            return fieldname1*147.3*fieldname5; 
    
        if(AND(fieldname5>=151, fieldname5<=300, fieldname6 == 'name56')) 
            return fieldname1*86.6*fieldname5; 
    
        if(AND(fieldname5>=301, fieldname5<=500, fieldname6 == 'name57'))
            return fieldname1*59.8*fieldname5; 
    
        return 0;
    })(), 2)

    Both equations are equivalent, but I prefer the second variant because it is easy to understand.

    Best regards.

    Thread Starter kna1337

    (@kna1337)

    thank you very match ??

    Thread Starter kna1337

    (@kna1337)

    How to display Summary field after clicking on the button, but before clicking it was hidden ?

    Plugin Author codepeople

    (@codepeople)

    Hello @kna1337

    Please, follow the steps below:

    1. Enter the hide class name through the “Add CSS Layout Keywords” attribute in the settings of the summary field.

    2. Enter the following piece of code as the “Onclick” event in the button’s settings:

    jQuery('.cff-summary-field.hide').removeClass('hide');

    Best regards.

    Thread Starter kna1337

    (@kna1337)

    And please tell me how, when choosing certain dropdown options, enable the display div section (ins section single line box and number box). (or single line, number)

    Dropdown opt: 1 – don’t show, 2 – show, 3 – show, 4 – show.

    Plugin Author codepeople

    (@codepeople)

    Hello @kna1337

    You can configure those fields as dependent on the choices in the dropdown field. Please, read the following blog post about dependencies:

    https://cff.dwbooster.com/blog/2020/03/01/dependencies

    Best regards.

    Thread Starter kna1337

    (@kna1337)

    thank you dude)

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘How to make 3 characters after the decimal point’ is closed to new replies.