Request page coding problem of a report.

Rajat_MRajat_M Member Posts: 34
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


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!


  • Options
    RockWithNAVRockWithNAV Member Posts: 1,139
    Why you are not using some of these Filters that comes in built with the Data items - That comes up when you run the Report instead of taking variables and doing so?.
  • Options
    Peter+is1Peter+is1 Member Posts: 174

    Give the variables names that are different from the field names.

    good luck.
    The truth exists in seven versions.
  • Options
    Rajat_MRajat_M Member Posts: 34
    Peter+is1 wrote: »

    Give the variables names that are different from the field names.

    good luck.

    Ok, I'll apply this..Thanks..!!
  • Options
    vaprogvaprog Member Posts: 1,128
    Take care! If you leave e.g. the "Item No." variable empty on the request page, your code will filter for Item Ledger Entries with an Item No. empty. Either you must check a code is given for each filter or you must guard each SETRANGE statement with
    IF <Requested Code> <> '' THEN SETRANGE ...
    for any field for which no code means no filter.

    Apparently you have done something like this already, because otherwise you would not get all entries when entering no filter codes on the request page.
Sign In or Register to comment.