Passing Filters to Requst Form on a report

n.topalovn.topalov Member Posts: 26
Hi,i searched the forum for relating topic but i didn't find a solution to my problem so :
I need to run a report from the Sales Order Form ,using a report variable.My question is how can i pass the filters (which are accordin to the selected Sale Order(doc no. and if any other) to the report and to atomaticaly visualize them to the requst form of the report.Remember i need to run the report from report variable.
Thank you in advance .

Answers

  • SavatageSavatage Member Posts: 7,142
    so basicaly you're asking.

    When you are on a sales order and want to run a report from the sales order form. You want the sales number you are currently on to have that value filled in the report when you access it.
    correct?

    Basicially it goes like this
    http://www.mibuso.com/forum/viewtopic.php?t=27676
  • n.topalovn.topalov Member Posts: 26
    yes thats right. The report has Sales Header table as a data item and i want when i run the report from the form to filter the data item for the document No. i was on the Form.
  • n.topalovn.topalov Member Posts: 26

    no that not solve my problem i need when i run the report the filters (the current record) to be placed in the request form as a filters to the coresponding request fields (automatically) ..[/quote]
  • SavatageSavatage Member Posts: 7,142
    #-o #-o

    RecVariable.setrange(YourField,Yourfield);
    report.runmodal(xxx,true,true,RecVariable);

    xxx is your report #

    for example you would put this code on the command button or menu item that accesses the report.

    understand?
  • garakgarak Member Posts: 3,263
    :lol: Sava be cool.
    Name	DataType	Subtype	Length
    SalesHeader	Record	Sales Header	
    
    SalesHeader.reset;
    SalesHeader.setrange("Document Type",Rec."Document Type");
    SalesHeader.setrange("No.",Rec."No.");
    //other filters
    //SalesHeader.copyfilters(Rec); <- this copies all filters on Rec to SalesHeader
    Report.run(205,true,false,SalesHeader);
    

    205 -> the ID of the Report also possible instead of the id
    REport::"The Name of the Report"

    Hope you understand it.

    Regards
    Do you make it right, it works too!
  • n.topalovn.topalov Member Posts: 26
    Yes thats work perfect but like i said in the begining i need to run the report by using a variable type-report ,not using REPORT.RUN(repID,...).Because i need , before run the report to call a function which is defined in the report.This function will fill a gVariable in the report which i have put in as SourceExp i some controls in the sections of the report.
    Hope you've understand me . :)
  • garakgarak Member Posts: 3,263
    The same way.
    clear(MyReport);
    SalesHeader.reset;
    SalesHeader.setrange("No.","no.");
    MyReport.MyFunction(MyParapeter);
    MyReport.SETTABLEVIEW(SalesHeader);
    MyReport.USEREQUESTFORM := true;
    MyReport.RUN;
    

    If you are in C/AL Symbol Menu (F5 in C/AL Editor) you can see al your variables, like MyReport, and the function / Properties of your variables. Sometimes its very usefull tu use the C/AL Symbol menu ;-)

    Regards
    Do you make it right, it works too!
  • n.topalovn.topalov Member Posts: 26
    Thank you very much this helped me a lot.This is a good tip. =D> =D>
  • garakgarak Member Posts: 3,263
    you're welcome.

    Please write [solved} infront of the subject in your first post.

    Thanks.
    Do you make it right, it works too!
Sign In or Register to comment.