Calculation formulas are quite important, as they are used for the detailed setup of the estimation for a job. In PrintVis we ship hundreds of standard formulas to help you calculate jobs correctly.

Some examples of standard formulas:  

  • Quantity 
  • Colors 
  • No. of sheets 
  • Weight of paper 
  • Waste 

There is also a great possibility to create your own formulas. You could combine several formulas and add some math, for example (Colors * Sheets) / Quantity. The conditional setup allows you to create a logic that selects different formulas based on the conditional formula. It’s possible to read from the User Field setup – only numbers of course. Any field setup reads number fields from some predefined tables. 

So, that will cover 95% of your formula demands for your setup, and in some cases it will cover 100%. 

Custom Calculation Formulas 

When do we need these?  

  1. You are not able to create a proper setup with the standard functions. 
  2. Performance: you are creating too complex a formula and it negatively affects the performance to the extent that it’s an issue. 

Simple example: 

This formula will give you a random number that is put back to the quantity field for the estimation detail. Of course, a random number is probably not useful, but here you could create any logic at all and make the result be exactly as you would like to have it. 

Report or CodeUnit? Since BC15 we have recommended CodeUnits; Reports will still work but will give the user an annoying dialog “Rendering Report,” – therefore please convert Reports to CodeUnits when upgrading. 

Reading Data from PrintVis Tables 

You can read data as normal from all tables in Business Central except: 

  • PVS Job Calculation Detail 
  • PVS Job Sheet 
  • PVS Job Process  
  • PVS Job Item 

These tables does not contain the proper data, as PrintVis is calculating with temporary tables. You need to read the data from the PVS SingleInstance.  

// only use this if needed – this can decrease performance if the formula is called many times
// SingleInstance.Get_CalcUnitDetailsRecTmp(JobCalculationDetailTemp); 
// SingleInstance.Get_SheetRecTmp(JobSheetTemp); 
// SingleInstance.Get_JobProcessTemp(JobProcessTemp); 
// SingleInstance.Get_JobItemRecTmp(JobItemTemp); 

What to Update 

You are only allowed to update the quantity, Item No and Unit. See the sample report on GitHub. 

Link to GitHub: 
https://github.com/printvis/PrintVis.BusinessCentral.ExampleCode/tree/main/Calculation%20Formula 

Watch the session video: