Home End User
New Blog Posts: Merging Reports - Part 1 and Part 2

Modify Criteria before preview

edited November 2002 in End User
Hi,

I code a end-user solution. All reports are in IB database.
I need to present the reports list to the end-user, and when the user choose
a report, display a modal windows to get a value. This value is passed to
one criteria in sql.
I can't use AutoSearchDialog Create because my parameter is choosen in an
IBTable.
With a sample found here, I can read the sql text and to find the criteria
in ppReport, but I don't understand WHERE I must display ma modal window to
modify this criteria value.

Which event is fired before the report was created ?

Thanks to help me !

--
enlevezmoi_alphomega@free.fr
http://alphomega.free.fr
http://www.codevinfo.com
ICQ 149635116

Comments

  • edited November 2002
    If you want to modify the search criteria, then use the example shown in the
    autosearch demos. There is one that shows how to modify the search criteria
    on an end user report. You could show a dialog in the OnGetAutoSearchValues
    event, just before the criteria value is set. If you want to add a criteria
    object to the TdaSQL object, then set it after the template is loaded. Use
    the Report.Template.OnLoadEnd event to create it on the fly. If the report
    gets saved, then free the criteria that already exist on the dataview's
    TdaSQL object. Here is an example to extract the SQL object and manipulate
    it in code.

    http://www.digital-metaphors.com/tips/ExtractSQLObject.zip


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited November 2002
    I use your code. It's this example I have found here. But, If I don't check
    "Recherche obligatoire" (compulsory research) in visual query builder, the
    OnGetAutoSearchValues event don't fire (ShowAutoSearchDialog is true). And I
    can't modifiy the criteria. If I check it, I can view the autosearch dialog
    created by RBuilder, next, the programme use my code, but the criteria isn't
    modified in the preview. The used value is the value got by your

    procedure TDataModuleBase.ppReport1GetAutoSearchValues(Sender: TObject);
    var
    S: TdaSQL;
    I: integer;
    begin
    if IBTblPR_Items.FieldByName('PR_ITEMID').AsInteger = 9 then
    begin
    GetSQLObject(ppReport1, S);
    S.Criteria[0].Value := '95';
    end;
    end;

    I put a breakpoint on the first line and the programm don't stop.

    --
    enlevezmoi_alphomega@free.fr
    http://alphomega.free.fr
    http://www.codevinfo.com
    ICQ 149635116
  • edited November 2002
    If you don't have any autosearch criteria defined on the dataview, then you
    can create a dummy AutosearchField on the report at runtime before the
    report prints so that the event gets called by the report. The event only
    gets triggered when autosearch fields exist. Use
    Report.CreateAutoSearchField to do this. Basically it will just cause the
    report to fire this event, since you are going to get you autosearch values
    from the database instead of the dialog or the criteria object on the
    dataview.

    Look in the RBuilder.hlp file for information on using autosearch in RB.

    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.