Knowledge Base
How can we help?
Full Site Search

Automatic daily recalculation

If you change a formula or a variable that is used in a formula very often, you have the option to add a script that will recalculate your formula every day. Please follow this guide to add your script.

Recalculate the whole entry

Step 1: Open the Ragic workflow editor.

Right-click on any of the application tabs and select Javascript Workflow, which will take you to the Workflow Module.

Step 2: Switch edit page to "Daily Workflow".

Step 3: Add the code for sheet formula recalculation.

If the URL link of the sheet you want to do this job is https://www.ragic.com/accountname/tabname/1

Add this line to the daily workflow:

db.recalculateAll("/tabname/1");

Don't forget to save your changes!

Recalculate specify fields

Step 1: Open the Ragic workflow editor.

Right-click on any of the application tabs and select Javascript Workflow, which will take you to the Workflow Module.

Step 2: Switch edit page to "Global Workflow".

Step 3. Copy and paste the scripts

function dailyFormulaRecalculate(pathSheet){

var pageSize = 1000; //read 1000 entries at a time

var qMain = db.getAPIQuery(pathSheet);

qMain.setUpdateMode();

var mainAr = null, mainOffset = 0;

while(mainAr==null || mainAr.hasMore()){

qMain.resetData();

qMain.setLimitSize(pageSize);

qMain.setLimitFrom(mainOffset);

mainAr = qMain.getAPIResults();

var iterator = mainAr.iterator();

while(iterator.hasNext()){

var entry = iterator.next();

entry.recalculateFormula(field ID);

entry.save();

}

mainOffset += mainAr.getData().size();

}

}

For field id please replace it with the field id of the fields that you would like to recalculate. So the result would look something like this:

entry.recalculateFormula(1000001);

entry.recalculateFormula(1000002);

entry.recalculateFormula(1000003);

Step 4. Switch edit page to "Daily Workflow"

If the URL link of the sheet you want to do this job is https://www.ragic.com/accountname/tabname/1

Add this line to the daily workflow:

dailyFormulaRecalculate("/tabname/1");

Top of Page
Learn more about Ragic:
Why we created Ragic
Webinars
User Guide
Ragic Pricing
Applications
Keep in touch:
Blog
Facebook
YouTube
Ragic, Inc.
1-888-666-8037
Terms
Privacy
info@ragic.com