• Resolved rotertal

    (@rotertal)


    Dear CFF-Team,

    I’m sure you can help because I’m a helpless newbie … ??

    I have several calculated fields with simple equations (e.g. multiplication, generating random numbers, etc.) put into the the “Set equation” Box. I’m using a button (calculation option) and everything works perfectly fine. Is it possible to only calculate specific fields when I hit my button and keep the other fields just like they are?

    I tried out the options provided in this forum, for example:

    jQuery(‘[id=”fieldname1_”]’).val(‘0’)
    jQuery(‘[id=”fieldname_”] :input’).val(”)

    and also the “ignorefield” via CSS but it either sets a value, clears it (which is already good because I also need that) or lets the field dissapear. I also tried something like caluculate, execute, etc. but ultemately I’m clueless (blush).

    Important note: I need to display my fields all the time, I do not want to have the option to dynamically execute the equations (since I only need specific fields) and finally it would be great to keep my equations in the box instead of putting it into the jQuery code (I saw something with function () ..)

    In other words, when “val” is refreshing or setting a specific value, what is the command for calculate?

    Kind regards,
    Marcella

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @rotertal

    Thank you very much for using our plugin.

    In the current plugin version, you can evaluate all the equations manually (by pressing a button) or dynamically (when their operands vary). But you cannot modify this behavior per field.

    An alternative would be to configure the evaluation of the equations dynamically but use a variable as a flag.

    Assuming you have two calculated fields that you want to evaluate manually: fieldname1 and fieldname2, with the equations:

    fieldname3+fieldname4

    and

    fieldname5*fieldname6

    Respectively. The fields’ names and equations are hypothetical, only to describe the process.

    First, edit the equations as follows:

    IF(AND('flag' in window, flag), fieldname3+fieldname4, '')

    And

    IF(AND('flag' in window, flag), fieldname5*fieldname6, '')

    The equations check if the flag variable exists and it is true. Otherwise, the equation returns the empty text.

    Now, in the onclick event of your button (note that it is not a calculate button. It is a common button that will evaluate only these two equations), you can enter the piece of code:

    flag=true; 
    EVALEQUATION('fieldname1');  
    EVALEQUATION('fieldname2'); 
    flag=false;

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Only calculate specific fields when hitting a button’ is closed to new replies.