FR and Stored Procedures?

edited November 2003 in FastReport 2.xx VCL
Hello, my name is Darkwater and I have to work with an Interbase Database, with Stored Procedures and with FR 2.50. The last time I tried to use SP in my FR-Queries, it did not work. Is there a special function or object or Syntax, that are made for Stored Procedures?
The last times I have analyzed the Procedure and converted it in a Query, but that is not optimal for me. It needs much more time, and I am sure that you are the same oppinion, that it isn't good for the server. These Procedures are realized to ease the work of the Workstations, not for writing a lot of queries with the same result as the Stored Procedure.
My boss always says: Every Reporting Tool (...Which means Crystal Report, which he uses for a few years...) can use Stored Procedures, but I don't agree with him.

Could you tell me, whether or not FR can use Stored Procedures? I have found nothing in the help-files...

Darkwater

Comments

  • SamuraySamuray Administrator
    edited 3:30PM
    Stored procedures don't supported directy by FastReport. Use custom functions or handlers on TfrReport.OnGetValue or TfrReport.OnUserFunction.

    Examples:

    procedure TForm1.frReport1GetValue(ParName: String; var ParValue: Variant);
    begin
    if ParName = 'MyField' then
    ParValue := Table1MyField.Value;
    end;

    procedure TForm1.frReport1UserFunction(const Name: String;
    p1, p2, p3: Variant; var val: Variant);
    begin
    if AnsiCompareText('SUMTOSTR', Name) = 0 then
    val := My_Convertion_Routine(frParser.Calc(p1));
    end;

  • edited 3:30PM
    The getvalue and userfunction would be OK for returning single values but how about returning a full dataset that you could use in the detail band?
  • edited 3:30PM
    Hi!

    Interbase/Firebird has the ability to use stored procedures in selects. This might help you. You can make a Query out of the SP. Like this;

    SELECT * FROM SP_NAME ('INPAR1')

    Only difference is the WHERE clause that is change to (). You can have a paramater inside the (). There are some more about this, se the IB docs. You can also use a subselect like

    SELECT T.ID, T.NAME, (SELECT A FROM SP (T.ID)) AS CALCULATED
    FROM TABLE T
    WHERE ...

    hope this help /thoug it's off topic).

    /D

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.