knowledgebase:best_practice_for_calculations

Let us consider calculating profit as example

Profit := Income-Expenditure;

There is no guarantee that Income and Expenditure data will always have a numeric data type. Some users may prefer to use 'No Income' or 'No Expenditure' values

The best way to avoid problems with data quality is to follow the pattern below.

  1. Create variables for every input parameter.
  2. Assign input parameters to variables inside try expect block
  3. Perform calculations
  4. Return value

Example:

Var
vIncome: Float;
vExpenditure: Float;

begin
// Converting strings to Floats
Try
vIncome:=Income;
except
vIncome:=0;
end;

try
vExpenditure:=Expenditure;
except
vExpenditure:=0;
end;

// Calculation

Result := vIncome-vExpenditure;
end;

For more technologies supported by our ETL Software see Advanced ETL Processor Versions and Visual Importer ETL Versions

Confused? Ask question on our ETl forum

  • knowledgebase/best_practice_for_calculations.txt
  • Last modified: 17/09/2018 09:44
  • by admin