4D View Pro: Enable, Disable, or Force calculations

Automatically translated from English

4D View Pro automatically recalculates the formulas in your worksheet when you change data they depend on (e.g., entries, formulas, names, etc.).

But what if you want to make your UI more interactive and trigger the calculation of formulas whenever you want? 4D v18 R4 makes it possible thanks to three new commands: VP SUSPEND COMPUTING, VP RESUME COMPUTING, and VP RECOMPUTE FORMULAS. These commands let you suspend and resume the calculation of all formulas in your document, or force their recalculation.

The HDI below demonstrates how to recalculate formulas after loading a record from the database and how to stop/resume the calculations in a document.

HDI Manage calculations

Recalculate formulas

When you use data from 4D (e.g., variables through methods or database fields), you need to refresh your formulas when this data changes. To do so, just use this line of code:

VP RECOMPUTE FORMULAS ("ViewProArea")

suspend and resume formula COMPUTING

The VP SUSPEND COMPUTING and VP RESUME COMPUTING commands allow you to temporarily turn off automatic calculations.

For example, to avoid calculation errors in your cells such as “#DIV/0!” while you’re still working on the document, use this code:

  • suspend the calculations in the document:

VP SUSPEND COMPUTING ("ViewProArea")

  • add your values or formulas in the cells
  • resume calculations:

VP RESUME COMPUTING ("ViewProArea")

In the same way, you can save time and be more efficient with large documents: manage the calculation of your formulas whenever you want!

Fabrice Mainguené

• Product Owner •

Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.

After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.