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

autosearch current date

edited July 2008 in General
Heya,

I'm looking for a way to print a report (RB 10) only when the enddate of
an employee's contract is past the current date.
Preferably without the user having to actually type in that date.

is that at all possible? if so, how??

kind regards,
M?lisande



--- posted by geoForum on http://delphi.newswhat.com

Comments

  • edited July 2008

    Here is some sample RAP code that shows how to use the TdaSQLBuilder class
    in the BeforeOpenDataPipelines event to add a search criteria on the
    CurrentDate.

    To convert to Delphi code, pass either the Report or the DataPipeline to the
    SQLBuilder constructor.

    procedure ReportBeforeOpenDataPipelines;
    var
    lSQLBuilder: TdaSQLBuilder;
    begin
    lSQLBuilder := TdaSQLBuilder.Create(Customer);

    lSQLBuilder.SearchCriteria.Add('Customer', 'LastInvoiceDate', '<',
    DateToStr(CurrentDate));

    lSQLBuilder.Free;

    end;

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited July 2008
    hi,

    thanks for the quick response.
    Though I can imagine this being the best possible solution, I cannot use
    it.
    I'm working with a database application of which Reportbuilder is a small
    part and thus I don't have all functions.

    This is what I have to work with under Report

    - AfterAutoSearchDialogCreate
    - AfterPrint
    - BeforeAutoSearchDialogCreate
    - BeforePrint
    - OnAssignPreviewFormSettings
    - OnAutoSearchDialogClose
    - OnCancel
    - OnCancelDialogClose
    - OnCancelDialogCreate
    - OnEndColumn
    - OnEndFirstPass
    - OnEndPage
    - OnEndSecondPass
    - OnGetAutoSearchValues
    - OnNoData
    - OnOutlineNodeCreate
    - OnPageRequest
    - OnPreviewFormClose
    - OnPreviewFormCreate
    - OnPrintDialogClose
    - OnSaveText
    - OnStartColumn
    - OnStartFirstPass
    - OnStartPage
    - OnStartSecondPass


    names:
    pipeline: Deelnames
    table and field containing date that should be in the future (>=
    currentdate): job.enddate enddate_3


    I really do hope you can help me.

    thanks in advance.

    kind regards,
    M?lisande




    class
    the



    --- posted by geoForum on http://delphi.newswhat.com
  • edited July 2008
    I'd ask the makers of the app to expose one more event.

    Barring that, is the auto search dialog created? If so, you could add it
    after that.

    Ed Dressel
    Team DM
  • edited July 2008
    already did, they won't alter it without my company having to pay extra
    for it, which will never happen.

    isn't there some way to have the autosearchdialog open with the
    currentdate already entered?
    if so, it could be something like

    open autosearch dialog
    enter current date
    hide autosearch dialog


    so the user wouldn't have to enter the date and maybe not even *see* the
    autosearchdialog entirely....
    that would be fantastic ^_^

    again, thanks in advance :-)

    kind regards,
    M?lisande



    --- posted by geoForum on http://delphi.newswhat.com
  • edited July 2008
    YAY!

    after going through lines and lines of archived posts I found what I was
    looking for:



    Procedure ReportBeforeAutoSearchDialogCreate

    Begin

    Report.AutoSearchFields[0].SearchExpression :=
    FormatDateTime('dd-mm-yyyy',CurrentDate);

    Report.ShowAutoSearchDialog := False;

    End;



    --- posted by geoForum on http://delphi.newswhat.com
This discussion has been closed.