Default values on Request Form

NavDevNavDev Member Posts: 21
Hi experts,

this is another basic question ... sorry for this.

I tried to initialize the data items (not the options-tab!) on the request form with specific values, that shall be identical to all users and active, whenever the request form opens. So I do not want to use "SaveValues" for the request form.

Let's say I want to initialize a report containing contacts with

City = 'Chicago'

i. e. when the request form open, the contact-tab should show the field "City" (->ReqFilterFields) and a given value of "Chicago", which can be changed by the user, but represents a default.

How (simple) is it done? Thanks in advance.

kind regards,

NavDev

Comments

  • DenSterDenSter Member Posts: 8,307
    Have you tried, in OnInitReport (which fires before you see the request form):
    Contact.SETFILTER(City,'=%1','Chicago');
    
  • NavDevNavDev Member Posts: 21
    hi DenSter,

    in fact I have. But it didn't work. :-(


    NavDev
  • DenSterDenSter Member Posts: 8,307
    That's where I thought it would be. I also tried setting the table filter in properties, and played around with FILTERGROUP, but I couldn't get it to work quickly. I am pretty sure though, if you do a SETFILTER like that in code when you call the report in C/AL from a form or something, that it works like that.
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Hi NavDev,

    This sound more simple than it actualy is. Daniels solution works and sets the filter, however it is not visible for the user.

    The only way to make the filters visible that I know of is to make a fuction that calls the report.

    e.g:
    Cust.SETRANGE(City, 'Amsterdam');
    Report.run(Report::X, true, false, Cust);
    

    Sorry, but I think this is all you can do.

    Regards,

    Mark
  • DenSterDenSter Member Posts: 8,307
  • NavDevNavDev Member Posts: 21
    thank you, guys!

    I see, it is not so easy as I thought. I think I will consider Mark's solution or try to live without it.

    best regards,

    NavDev
  • georgegeorge Member Posts: 11
    Hello guys,

    is this realy the only solution to call the report via CU?
    it realy works fine whith the CU but i think it´s not the best solution. :(

    Have anybody ideas?

    greets
    george
  • DenSterDenSter Member Posts: 8,307
    Doesn't have to be a codeunit. It can be from a button, or another report, or anywhere else that you can access the C/AL editor.
  • georgegeorge Member Posts: 11
    DenSter wrote:
    Doesn't have to be a codeunit. It can be from a button, or another report, or anywhere else that you can access the C/AL editor.

    Like NavDev wrote:
    NavDev wrote:

    Let's say I want to initialize a report containing contacts with

    City = 'Chicago'

    so it´s impossible to initialize the Report with standard values?
    hmmm ](*,)


    greets
    george
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
  • DnealDneal Member Posts: 103
    Hi experts,

    I am running a report within a report so I can get the default filters to appear on the request form. The only issue I'm have is when I set the ReqWindow to TRUE I get two preview windows. When I set it to false I don't get either. I only want to show the request form for the report I"m calling not the one I'm using to call that report. I hope this makes sense.

    Thanks all,

    Dneal
  • themavethemave Member Posts: 1,058
    not sure if I am missing something, and I haven't had a need to do this, but my first thought is to:

    1. set a user defined global variable city1 and put this on the request form
    2. then set the initial value on the report OninitReport section
    City1 := "Chicago"
    3. Then before the report is ran set the filter on the onPreDataItem section
    Customer.SETFILTER("City", City1);

    so the user would change the filter in the request form, only problem would be that they couldn't use a lookup to get values, they would have to type them in. but worst case if they spell it wrong the report would just be blank.


    on edit, just realized the date of the original thread is very old, and the question just above this really is a different question then the original thread was asking, I answered for the original thread, not the post just above this one.
  • zaq1028zaq1028 Member Posts: 19
    You can set the Global Variable for the Request Page option in the OnOpenPage() under the Request Page. If you attempt to set them in either InitReport, it does not work because the variable has not been created yet (according to the debugger).
  • ivicaSDivicaSD Member Posts: 9
    edited 2017-01-16
    And there is one sufficient answer to this question in following forum post:

    http://forum.mibuso.com/discussion/35317/default-filter-on-report
    --
    Ivica
Sign In or Register to comment.