Printing one record from a navision form

Koen_RoggemanKoen_Roggeman Member Posts: 17
edited 2010-09-08 in Navision Attain
Hello,

How can I print one record from a form. When I print I get all the records that are present in my table.
I think it has to do something with a filter but I am not sure.

thx for the help !!

Comments

  • AdministratorAdministrator Member, Moderator, Administrator Posts: 2,500
    Topic moved from Navision Tips & Tricks to Navision Attain. Please don't ask questions in the Navision Tips & Tricks forum.
  • jhoekjhoek Member Posts: 216
    Place a button on the form, and add the following code to the OnPush trigger of this button.

    MyRecord := Rec;
    MyRecord.SETRECFILTER;
    REPORT.RUNMODAL(REPORT::"ReportName", true, false, MyRecord);

    where...
    MyRecord is a record var of the same subtype as Rec
    ReportName is the name of the report that is to be used for printing.
    Kind regards,

    Jan Hoek
    Product Developer
    Mprise Products B.V.
  • kongmikkongmik Member Posts: 7
    Why is it that it is nessary to declare another variable and pass rec to it before using report.runmodal.

    Why does this not work:
    Rec.SETRECFILTER;
    REPORT.RUNMODAL(REPORT::"ReportName", true, false, Rec);

    ?
    ---
    jhoek wrote:
    Place a button on the form, and add the following code to the OnPush trigger of this button.

    MyRecord := Rec;
    MyRecord.SETRECFILTER;
    REPORT.RUNMODAL(REPORT::"ReportName", true, false, MyRecord);

    where...
    MyRecord is a record var of the same subtype as Rec
    ReportName is the name of the report that is to be used for printing.
  • jhoekjhoek Member Posts: 216
    I usually do that to ensure that running the report doesn't affect Rec in any way, and to allow me to set additional filters on "MyRecord" - again without affecting Rec. Makes sense?
    Kind regards,

    Jan Hoek
    Product Developer
    Mprise Products B.V.
  • SavatageSavatage Member Posts: 7,142
    7 Year clarification! :mrgreen:
  • kongmikkongmik Member Posts: 7
    Yes it makes sense! Thank you.
Sign In or Register to comment.