Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / How to create a multi-...
Finance forum
Answered

How to create a multi- line option to print on SSRS Report for invoice journal report D365FO

Posted on by 388
Hi, im creating a new option for the invoice journal report. i created a button and command button on the form, that allow the user to select multiple  records all together.
I also created a class that contains the multi parameter.
and i added this logic to my data provider class, but for some reasons its not working. ( note that this report was done before for only 1 line.)
 
here is my dp class with the logic implemented:
////
the rest of the code is the report's logic. but this part is related to multi lines.
 
please any help would be appreciated.
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 229,173 Most Valuable Professional on at
    How to create a multi- line option to print on SSRS Report for invoice journal report D365FO
    Okay, let me add comments to code. You'll see it's very simple:
    // Here they create MultiSelectionHelper object. Note that createFromCaller() isn't the only possible way.
    MultiSelectionHelper multiselectionHelper = MultiSelectionHelper::createFromCaller(_args.caller());
    
    // Get the first record from multiselectionHelper 
    IntentLetter_IT intentLetter = multiselectionHelper.getFirst();
    
    // Check if there is a record to process
    while (intentLetter)
    {
        // Add data to a list. Here they use a list of records, but you can also use a list of primitive values (such as record IDs).
        intentLetterList.addEnd(intentLetter);
    
        // Get the next selected record
        intentLetter = multiselectionHelper.getNext();
    }
    As I told you, can find more examples in the application and more details in articles on internet.
  • D365FO DEV Profile Picture
    D365FO DEV 388 on at
    How to create a multi- line option to print on SSRS Report for invoice journal report D365FO
    is there a documentation for MultiSelectionHelper: IntentLetterCancelController_IT::main() since i never used it before because its my first time doing this kind of task
  • Martin Dráb Profile Picture
    Martin Dráb 229,173 Most Valuable Professional on at
    How to create a multi- line option to print on SSRS Report for invoice journal report D365FO
    There is no point in starting the discussion from scratch and repeating everything once more. Instead, please read the discussion again.
     
    We already discussed the design and a plenty of implementation details. You even missed that I already gave you a concrete example of usage of MultiSelectionHelper: IntentLetterCancelController_IT::main().
     
    Also, your scenario is about parameters of a report. Let me repeat your words: "we selected both records, we need to print them". It means that the information about selected records is a parameter of the report. Maybe you mean that you don't want to show this parameter to users, but that doesn't mean that what to print isn't a parameter of the report.
  • D365FO DEV Profile Picture
    D365FO DEV 388 on at
    How to create a multi- line option to print on SSRS Report for invoice journal report D365FO
    Dear martin, thanks for your prompt response. after you got a clear view of my issue. can you guide me with the correct steps in order to fix my issue? 
    (on the internet, i found multi select lookup but its for report parameter. which is not my case)
    also all my source code are provided
     
    thanks
  • Martin Dráb Profile Picture
    Martin Dráb 229,173 Most Valuable Professional on at
    How to create a multi- line option to print on SSRS Report for invoice journal report D365FO
    Yes, I understand that the requirement. Please follow the suggestions we gave you, including the technical details that I shared in my last reply (and you didn't react to so far).
     
    When you get stuck, explain your problem to us, including showing your current code and explaining where it fails. Don't expect us to know what problem you're struggling with at the moment; you must write it down.
  • D365FO DEV Profile Picture
    D365FO DEV 388 on at
    How to create a multi- line option to print on SSRS Report for invoice journal report D365FO
    Dear martin, in my case. 
    1. i created a customized report from scratch to show the invoice journal. it was only showing 1 record ( as u can see in the picture below.
     
    2. then, it was requested that we should be able to select more than  1 record to print in  a single report. so lets say we selected both records, we need to print them. but the original print button will lock, so what i did is i created a button and command extension on the form.
    and to a class ( i shared before) that is responsible for the multi parameter. and i modified my data provider class with a while select loop since we dont know how many records the user selects.
    after debugging my code, the issue is in my while select./ i believe the relation between the tables is wrong.
     
    i hope u got mt point with this explanation.
     
  • Martin Dráb Profile Picture
    Martin Dráb 229,173 Most Valuable Professional on at
    How to create a multi- line option to print on SSRS Report for invoice journal report D365FO
    Are you saying that you won't tell us anything about your current implementation because you decided that it's wrong and it must be reworked?
     
    It would help if you explained your particular problem(s) rather then asking for an example of everything.
     
    I'll assume you know what a data contract class is and how to call methods, and that your problem is just with the list. You'll find a plenty of examples in the standard application, such ProcCategoryContract.parmCompany().
     
    Regarding MultiSelectionHelper, you can find many examples both in the application and on internet. For example, look at IntentLetterCancelController_IT::main(). There you'll also see how to add elements to a list (addEnd() method).
  • D365FO DEV Profile Picture
    D365FO DEV 388 on at
    How to create a multi- line option to print on SSRS Report for invoice journal report D365FO
    Dear martin,
    can you provide any source code of  type parm method in the contract class - Inside prePromptModifyContract method use MultiSelectHelper class to loop through the selected records and insert into the list.?
    thanks
  • Martin Dráb Profile Picture
    Martin Dráb 229,173 Most Valuable Professional on at
    How to create a multi- line option to print on SSRS Report for invoice journal report D365FO
    No improvement of the while loop can help if you never pass the necessary input data to your report. Could you please read my and GirishS's reply and respond to them?
  • D365FO DEV Profile Picture
    D365FO DEV 388 on at
    How to create a multi- line option to print on SSRS Report for invoice journal report D365FO
    Hi Martian Drab, 
     when using Print Journal > Vendor invoice journal,  i want to print either whole journal or the selected lines. my temp table is  ex_invoicejournaltmp.
    my report design is tablix.
    i believe my issue is in the nested while select, the condition is not correct.
    please if you can provide me the correct while loop to be added, will be grateful or any source of code that can help.
    thanks

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,867 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,173 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans