Options

Capturing a date filter

BokkBokk Member Posts: 138
edited 2003-06-23 in Navision Attain
I have created a report with 3 dataitems, indented as follows ->
Customer
Job
Job Ledger Entries

The user can/should select a date range on the request form based on the "Date Filter" field in the Job table (Ledger DataitemLink:Job No.=FIELD(No.),Posting Date=FIELD(Date Filter). PrintOnlyIfDetail:YES in Job Dataitem. I have Job header info in 2 sections so it will print for each job and at the top of the next page if job details spans more than one page. The PrintOnlyIf Details property does not seem to stop the header printing when there are no ledger details. For each job I tried to check the ledger entries in code, but cannot seem to capture the Date Filter off the request form to set the SHOWOUTPUT accordingly. How would I reference this correctly?

OnPreSection() - Header section
JobLedger.SETCURRENTKEY("Job No.","Posting Date");
JobLedger.SETRANGE("Job No.",Job."No.");
JobLedger.SETFILTER("Posting Date",'="Date Filter"');

Thanks
SGM

Comments

  • Options
    mortenreeslevmortenreeslev Member Posts: 11
    Hello

    JobLedger.SETCURRENTKEY("Job No.","Posting Date");
    JobLedger.SETRANGE("Job No.",Job."No.");
    JobLedger.SETFILTER("Posting Date",'="Date Filter"');
    Should be something like this instead...
    JobLedger.SETFILTER("Posting Date",'>=%1&<=%2',"Starting Date","Ending Date");

    "Starting Date" and "Ending Date" are Date variables in request form...
    Maybe you should consider moving your code to OnPreDataItem trigger...



    In .NET we believe :mrgreen:
  • Options
    jyotsnasjyotsnas Member Posts: 62
    Hi

    Actually you dont even have to use request form.
    You can use GETFILTER to get the filter specified by user.

    FilterString := GETFILTER("Date Filter");

    (FilterString is a Text variable)

    then you can use it to apply filter

    RecVariable.SETFILTER("Date Field", FilterString );

    Regards
    Jyotsna
    ______Doubt is the father of Invension_______
Sign In or Register to comment.