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

From eStream Software
Line 3: Line 3:


==Steps==
==Steps==
Below is example using Sales Invoice
Below is example using Sales Invoice to get Shelf field from Maintain Item
[[File:RB-GetDirectDB-01.jpg|800 px]]
[[File:RB-GetDirectDB-01.jpg|800 px]]
 
:01.
:02.
:03.
:04.
[[File:RB-GetDirectDB-02.jpg|800 px]]
[[File:RB-GetDirectDB-02.jpg|800 px]]
 
:05.
:06.
:07. Enter the below script
<syntaxhighlight lang="delphi">
<syntaxhighlight lang="delphi">
 
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;
</syntaxhighlight>
</syntaxhighlight>
* More coming soon...
* More coming soon...

Revision as of 08:57, 12 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 RB-GetDirectDB-01.jpg

01.
02.
03.
04.

RB-GetDirectDB-02.jpg

05.
06.
07. 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;
  • More coming soon...