Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Request page coding problem of a report.

Posted on by Microsoft Employee

Hello Experts,

                        Right now I'm working on a report. I have taken two DataItems: Item Ledger Entry & Item Journal Line. Now I need to set four request page filters i.e. Item No., Location Code, Entry Type, Posting Date(Start Date, End Date).

                         For that I have taken five variables in C/AL Global i.e. Item No.(Code), Location Code(Code), Entry Type(option), Start Date(Date), End Date(Date).

                         I have also declared those fields on Request Page Designer.

                         Now I have written the following code:

Item Ledger Entry----- OnPreDataItem():

SETRANGE(Item Ledger Entry.Posting Date, Start Date, End Date);

SETRANGE(Item Ledger Entry."Item No.", "Item No.");

SETRANGE(Item Ledger Entry.Location Code, Location Code);

SETRANGE(Item Ledger Entry.Entry Type, Item Ledger Entry.Entry Type :: "Negative Adjustment");

                         The code has run but whenever I enter any values on the request page the report doesn't shows any data. If I left those fields empty the report shows all the data. I have no clues how to correct it. Please Help me!

                                              

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Request page coding problem of a report.

    What is your exact requirement? What is the end result that you are trying to achieve?

    I would not recommend to use Item Ledger Entry as data item. Instead you should use ItemLedgerEntry as variable to get the desired result.

  • Binesh Profile Picture
    Binesh 7,885 on at
    RE: Request page coding problem of a report.

    Hello Rajat,

    Do one thing first run the table Item Ledger entry with those filters, and check you are getting data or not.

    If you get the data, then run report with "About This Report" [After running the Report, you can find under Help Menu, See the bellow screenshot].

    about-this-report.png

    Once you will get data on "About This Report" window then intimate us, we will give you solution.

  • Suggested answer
    RE: Request page coding problem of a report.

    Hi Rajat,

    I rewrote your code and with a small change I was able to make it happen. Try and let me know.

    Item Ledger Entry --- OnPreDataItem()
    
    indication := (ItemNo <> '') OR (LocationCode <> '') OR
                    (StartDate <> 0D) OR (EndDate <> 0D) OR
                      (EntryType <> 0);
    
    IF indication THEN
    BEGIN
      "Item Ledger Entry".SETRANGE("Item Ledger Entry"."Posting Date", StartDate, EndDate);
      "Item Ledger Entry".SETRANGE("Item Ledger Entry"."Item No.", ItemNo);
      "Item Ledger Entry".SETRANGE("Item Ledger Entry"."Location Code", LocationCode);
      "Item Ledger Entry".SETRANGE("Item Ledger Entry"."Entry Type", EntryType);
    END;


    indication will be a Global C/AL variable - Type Boolean.

    Hope it helps. 

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,137 Super User 2024 Season 2 on at
    RE: Request page coding problem of a report.

    do you have records in combination of all those filters.

    I guess you didn't have records in table as you are getting if you apply only 1 at a time.

    the filters applied as AND and not OR statement.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Request page coding problem of a report.

    Yeah it has some..but if I only run a single unit of code by keeping others within the comment {} then I'm getting the desired result but only for a single field at a time.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Request page coding problem of a report.

    Thanks.. & please suggest what else I can do?

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,137 Super User 2024 Season 2 on at
    RE: Request page coding problem of a report.

    do you have data with above filters? Please check Item Ledger Entries

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Request page coding problem of a report.

    Hi,

    I would recommend using setfilter for dates, and why you are specifying the entry type as negative in the codes?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans