• Resolved angelo791

    (@angelo791)


    Hi, first of all great plugin! I want to display the fieldname value in the “Symbol to display at the end of calculated filed” of another fieldname, it is possible to do? How?

    And also the plugin works great on every pc browser but on phone doesn’t show the results in the summary, I check it on differents browser, same results. Can you help me?

    For the mobile issue the link to the page is https://oasiblupiscine.com/calcolo-prodotti-chimici/
    and the code of one of the result is

    if(fieldname5==1){
    PREC((fieldname2*fieldname3*fieldname8),2)
    }
    
    if(fieldname5==2){
    PREC((fieldname2*fieldname3*fieldname8*0.785),2)
    }
    
    if(fieldname5==3){
    PREC((fieldname2*fieldname2*fieldname8*0.785),2)
    }
    
    if(fieldname5==4){
    PREC((fieldname2*fieldname3*fieldname8*0.85),2)
    }

    the code of other result are similar
    Thanks

    • This topic was modified 6 years, 6 months ago by angelo791.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @angelo791,

    The code of your equation is invalid and generate a parser error. If you want to use the javascript conditional statement “if” in the equation, you must create it usin the “function” structure, and include “return” instructions to return the equation’s results (Note that this error is present in most equations in your form).

    
    (function(){
      if(fieldname5==1){
        return PREC((fieldname2*fieldname3*fieldname8),2);
      }
    
      if(fieldname5==2){
        return PREC((fieldname2*fieldname3*fieldname8*0.785),2);
      }
    
      if(fieldname5==3){
        return PREC((fieldname2*fieldname2*fieldname8*0.785),2);
      }
    
      if(fieldname5==4){
        return PREC((fieldname2*fieldname3*fieldname8*0.85),2);
      }
    })()
    

    There are other alternatives, for example, using the “IF” operation included by the plugin (javascript is a case sensitive language, do not confuse the conditional statement “if” with the operation “IF” implemented in the plugin), but with this number of different conditions, the code would be less readable:

    
    PREC(fieldname2*fieldname3*fieldname8*IF(fieldname5==1, 1, IF(OR(fieldname5==2,fieldname5==3), 0.785,0.85)),2)
    

    Concerning to the first question, you cannot enter the name of other field as the symbol to display at the end of the calculated field, but you can add a text to the result as part of the equation, for example:

    
    (fieldname1+fieldname2)+' text here'
    

    and that’s all.
    Best regards.

    Thread Starter angelo791

    (@angelo791)

    It works perfectly, thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display fieldname value tips and mobile issue’ is closed to new replies.