How do i pass a variable from a Report to a Form?

kenyokenyo Member Posts: 40
Hi, so i have a Form that calls a Report in an OnPush()-Trigger. After the Report is run, i want to pass two Integers back to the Form. Is there any way to do it?
Since apparently all variables are cleared after Report.RUN is executed i cant follow up with get functions in the Report. I also tried it the other way around and put set functions in my form and tried to update the form fields in the OnPostDataItem() of the Report... that doesn't work either ( apparently it's passing the values to a new instance of the form instead of using the one that is currently running.


EDIT: all i had to do was RUNMODAL instead of RUN. I don't know why but apparently the variables don't get cleared this way

Answers

  • swpoloswpolo Member Posts: 80
    I suppose it is not very good way, but anyway.
    You can create codeunit and set it to single instance and create required variables, procedures to set and read variables.
    Make modifications in the report to update varaible values in codeunit by calling procedure to set variables in codeunit .
    On the form, On OnPush trigger, once after report run, get variables from codeunit.
    Nav Upgrades and DEV outsourcing
    Reports transformation to RDLC
    List -1h , Complex List -3h, Document -4h (dev hours)
    navisionupgrade.com
  • kenyokenyo Member Posts: 40
    edited 2019-05-16
    I didn't want to use a codeunit since the report was already done. But yea , i edited the solution in my OP. RUNMODAL doesn't destroy the Object instance so i could just fetch them after the report was run. thanks anyway though.
Sign In or Register to comment.