FAQ
How can we help?
Full Site Search

Adding a button to formula recalculate a single record

To recalculate all formulas or the formula assigned in a field for a single record instead of all records, you can add an action button to execute formula recalculation for the current record by adding a simple script.

Please follow this guide to add your script:

Step 1: Open the Ragic workflow editor.

Right-click on the sheet name under the tab and select Javascript Workflow, which will take you to the Workflow Module.

Step 2: Switch the page being edited to the "Installed sheet scope".

Step 3: Modify and add the following code to your installed sheet scope and save.

Remember to change the '/sales/3' in the example code below to your own sheet path.

Example If your sheet url is 'www.ragic.com/sample/sales/3', the code would be written as following:


function recalc(nodeId){
  var query=db.getAPIQuery('/sales/3');
  var entry=query.getAPIEntry(nodeId);
  entry.recalculateAllFormulas();
  entry.save();
}

If you would like to only do recalculate for a single field, let's say with field id 1000001. You can use this instead:


function recalc(nodeId){
  var query=db.getAPIQuery('/sales/3');
  var entry=query.getAPIEntry(nodeId);
  entry.recalculateFormula(1000001);//recalculate formula for only field id 1000001
  entry.save();
}

Step 4: Add the action button to your sheet.

Under the form page design mode of the sheet, navigate to Form Settings > Actions. Add a new action as following:

Action name: The name of the action button.

Action type: JS Workflow

Action: recalc({id});

Remember to click "Add Action" and save your design changes.

Top of Page

    Start Ragic for free

    Sign up with Google