Report Builder - Doing Simple Calculation

From eStream Software
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Introduction

In Report Builder you can also do some simple calculation using the Variable (The Calculator Icon)

Steps

Below is example using Sales Invoice to get Net Unit Price (after Discount)

RB-SimpleCalc-01.jpg
01. Click on SubRptNorm: Document_Detail
02. Select the Variable button (the Calculator icon)
03. Click on the place to be print/shown.
04. Click on Calc Tab
RB-GetDirectDB-02.jpg
05. Right click here & Select Event & find the component just now we had placed (eg Variable2)
06. Click OnCalc
07. Click here & enter the below script
procedure Variable2OnCalc(var value: Variant);
begin
  Variable2.DisplayFormat := Option.GetFieldValue('StockPriceDisplayFormat'); // Set Display Format
  Value := Document_Detail.GetFieldValue('Amount')/Document_Detail.GetFieldValue('Qty');
end;
08. Click File | Save As & enter New report Name after done

See also