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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

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

(1) ShareShare
ReportReport
Posted on by 406
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.
I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,803 Most Valuable Professional on at
    Does it mean that when using Print Journal > Vendor invoice journal, you don't actually want to print the whole journal, but just some selected lines?
     
    It would help if you described your problem - its not working" can mean anything.
     
    But I think I see a huge design flaw. The usual approach would be putting information about selected lines to the contract object. You don't do that; you seem to be putting the information to a table (Ex_VoucherNos) instead (although you don't to ever use the data). You didn't tell us what type of table it is, but it looks wrong in either case. If it's a temporary table, you never pass the data to the RDP class, therefore it's completely ignored. If it's a regular table, it would work, but only if the report was never used by more one user at once. My recommending is throwing the table away and using the  contract object. For example, you can use a list of RecId.
     
    By the way, you can simplify your code with MultiSelectionHelper. Also, you'll make your code easier to understand (for both us and yourself) if you pay more attention is correct indentation, naming conventions and splitting code to smaller methods with descriptive names.
  • Verified answer
    GirishS Profile Picture
    27,827 Moderator on at
    Hi Mounir,
     
    Using intermediate table is not a good idea. Instead create a list type parm method in the contract class - Inside prePromptModifyContract method use MultiSelectHelper class to loop through the selected records and insert into the list. Pass that list to contract class. Later you can iterate the list in the DP class.
    Also, from the screenshot please try to avoid nested while select statement as it will affect performance of the report and it will throw issues while generating CAR report.
     
    Thanks,
    Girish S.
  • D365FO DEV Profile Picture
    406 on at
    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
  • Martin Dráb Profile Picture
    237,803 Most Valuable Professional on at
    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
    406 on at
    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
    237,803 Most Valuable Professional on at
    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
    406 on at
    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
    237,803 Most Valuable Professional on at
    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
    406 on at
    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
    237,803 Most Valuable Professional on at
    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.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans