Fast Report - Get Data Directly from DB

From eStream Software
Revision as of 02:18, 11 November 2015 by Twfaung (talk | contribs) (→‎Steps)

Introduction

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

There are 2 ways to Get the data directly from Database

  • Simple Query
  • Advance Query

Simple Query

Steps

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

FR-DirectDB-01.jpg
01. Click the Red A Icon.
02. Click on the place to be print/shown.
03. Click on Events tab
04. Double Click OnBeforePrint
05. Enter below script
procedure Memo18OnBeforePrint(Sender: TfrxComponent);
var s : string;
    V : Variant;                            
begin
  //Get Shelf From ST_Item
  s := Format('SELECT Code, Shelf FROM ST_ITEM WHERE Code=%s ', [QuotedStr(<Document_Detail."ItemCode">)]);    
  V := MemDSCache.GetSQLValue(s, 'Code', <Document_Detail."ItemCode">, 'Shelf');                     
  if V <> null then                                        
    Memo21.Text := V else
    Memo21.Text := '';
end;
10. Save the report.
  • More Coming Soon....

See also