web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Can anyone tell me the straightforward list of steps to pass values from a form to a report?

(0) ShareShare
ReportReport
Posted on by 5

I have deployed my SSRS report HrvRepairPacket1 which requires the parameter REPAIRID to run.

These are the steps I have completed:

Controller Class:

public class HrvRSPController extends SrsReportRunController

{

}

public static client void main(Args _args)

 {

 //define the new object

 HrvRSPController controller = new HrvRSPController();

 //pass the caller args to the controller

 controller.parmArgs(_args);

 //set the report name and report design to run

 controller.parmReportName(ssrsReportStr(HrvRepairPacket1, PrecisionDesign1));

 //suppress the report dialog

 controller.parmShowDialog(false);

 //execute the report 

controller.startOperation();

 }

 

public void prePromptModifyContract()

{

  add a range in the report query

     SrsReportHelper::addParameterValueRangeToQuery(this.getFirstQuery(),tableNum(hrvRepairTable),fieldNum(hrvRepairTable, RepairId),SysQuery::value(this.parmArgs().record().RecId));

 }

I created an Output Menu Item which calls the class and set the linked permissions: Type - SSRSReport Object - HrvRepairPacket1 Child - PrecisionDesign1

I am running the output item from a button in the form, but the REPAIRID is not passing into the report.

What step(s) am I missing.  PLEASE PLEASE PLEASE answer like I am two years old.  This is my first attempt at x++ and so far of the dozens of "examples" of how to do this, there always seems to be something that it is just assumed that I should know and the result is that the process does not work.

I have the same question (0)
  • Sergei Minozhenko Profile Picture
    23,093 on at
    RE: Can anyone tell me the straightforward list of steps to pass values from a from to a report?

    Hi DMoore46350,

    Your code requires an active record from the caller. Are you calling the report from the form or from the main menu?

    Also, what is the type you used for RepairId? Is it RecId or string value?

  • DMoore46350 Profile Picture
    5 on at
    RE: Can anyone tell me the straightforward list of steps to pass values from a from to a report?

    I am calling the report from a button in the form using the Menu Output Item.  You see a list of repairs, then open a form to view details.  In that form, there is the REPAIRID.

    5125.image-_2800_1_2900_.png

  • DMoore46350 Profile Picture
    5 on at
    RE: Can anyone tell me the straightforward list of steps to pass values from a from to a report?

    The REPAIRID is a string value.

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Can anyone tell me the straightforward list of steps to pass values from a from to a report?

    Your code looks ok, except for one thing.

    You are passing RecId of the caller record, and using it to filter HrvRepairTable by RepairId. Is this what you intend to do?

    What type of table are you passing with the args? Is it also a HrvRepairTable?

    To make it easier for you to troubleshoot, let's add some code to be executed in prePromptModifyContract:

    public void prePromptModifyContract()
    {
        if (this.parmArgs().record())
        {
          Common callerRecord = this.parmArgs().record();
          info(tableId2pname(callerRecord.TableId)); // This will tell you what table is being passed
          info(int642str(callerRecord.RecId)); // This will show what RecId it has
          
          if (callerRecord.TableId == tabeNum(hrvRepairTable))
          {
              // If the caller was hrvRepairTable, let's use hrvRepairTable.RepairId as range
              hrvRepairTable repairTableLocal = callerRecord;
              SrsReportHelper::addParameterValueRangeToQuery(this.getFirstQuery(),tableNum(hrvRepairTable),fieldNum(hrvRepairTable, RepairId),SysQuery::value(repairTableLocal.RepairId));
          
          }
        }
     }

    Please note that I don't know anything about your data model except what you shared, and my code is based on some guesswork. Feel free to share more information about your implementation if you need better help. Thanks!

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at
    RE: Can anyone tell me the straightforward list of steps to pass values from a from to a report?

    Hi DMoore46350,

    I guess you need to cast record from args to table type used on the form (i assume it's hrvRepairTable) and use the value from RepairId in the filter. Try also to debug this method to check what do you have in this.parmArgs().record().

    public void prePromptModifyContract()
    
    {
    
        //add a range in the report query
        hrvRepairTable hrvRepairTable = this.parmArgs().record();
    
         SrsReportHelper::addParameterValueRangeToQuery(this.getFirstQuery(),tableNum(hrvRepairTable),fieldNum(hrvRepairTable, RepairId),SysQuery::value(hrvRepairTable.RepairId));
    
     }

  • DMoore46350 Profile Picture
    5 on at
    RE: Can anyone tell me the straightforward list of steps to pass values from a from to a report?

    Why are you saying what  "Table" is being passed?  My query needs the REPAIRID.  A single string.  Not a table.

  • DMoore46350 Profile Picture
    5 on at
    RE: Can anyone tell me the straightforward list of steps to pass values from a from to a report?

    pastedimage1596628254077v1.png

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Can anyone tell me the straightforward list of steps to pass values from a from to a report?

    this.parmArgs().record() returns the table buffer (record) that was passed from the caller form. So we are talking about a table because in your code (that you developed, and shared with us) you are handling a table buffer.

    The table buffer is passed automatically if your report menuitembutton has a data source selected on your form. Or it's part of a button group which has a data source selected.

    Assuming that the caller record has RepairId field, then it fulfills your requirement and you have RepairId available in your report class, as illustrated by our sample codes above.

    Is it good now?

  • DMoore46350 Profile Picture
    5 on at
    RE: Can anyone tell me the straightforward list of steps to pass values from a from to a report?

    0451.image-_2800_2_2900_.png

  • DMoore46350 Profile Picture
    5 on at
    RE: Can anyone tell me the straightforward list of steps to pass values from a from to a report?

    6116.image-_2800_3_2900_.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,004

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 865 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 582 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans