Report Builder - Get Data Directly from DB: Difference between revisions

From eStream Software
Line 6: Line 6:


===Using Variable===
===Using Variable===
[[File:RB-GetDirectDB-01.jpg|800 px]]
[[File:RB-GetDirectDB-01.jpg|800 px|center]]
:01. Click on '''SubRptNorm: Document_Detail'''
:01. Click on '''SubRptNorm: Document_Detail'''
:02. Select the '''Variable''' button (the Calculator icon)
:02. Select the '''Variable''' button (the Calculator icon)
:03. Click on the place to be print
:03. Click on the place to be print
:04. Click on '''Calc''' Tab
:04. Click on '''Calc''' Tab
[[File:RB-GetDirectDB-02.jpg|800 px]]
[[File:RB-GetDirectDB-02.jpg|800 px|center]]
:05. Right click here & Select '''Event''' & find the component just now we had placed (eg Variable2)
:05. Right click here & Select '''Event''' & find the component just now we had placed (eg Variable2)
:06. Click '''OnCalc'''
:06. Click '''OnCalc'''

Revision as of 05:44, 31 October 2015

Introduction

Sometime in the report you might wanted some extra information but you not able to select in the report design. So we had to self query to get the extra information.

Steps

Below is example using Sales Invoice to get Shelf field from Maintain Item

Using Variable

RB-GetDirectDB-01.jpg
01. Click on SubRptNorm: Document_Detail
02. Select the Variable button (the Calculator icon)
03. Click on the place to be print
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);
var s: string;
begin
  s := 'SELECT Shelf FROM ST_ITEM ' +
        'WHERE CODE=' + QuotedStr(Document_Detail.GetFieldValue('ItemCode'));
  if Trim(DBSQL_GetFieldValue(s)) <> '' then
    Value := Trim(DBSQL_GetFieldValue(s));
end;
08. Click File | Save As & enter New report Name after done
  • More coming soon...

See also