Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Show PurchOrderFormNum from table CustInvoiceTable in FreeTextInvoice report?

Posted on by 452
Hello to all in the community,
 
Thanks for reading my question.
 
This field 'PurchOrderFormNum' as shown in the form: CustFreeInvoice. That field is defined in table: CustInvoiceTable.
I want to show this field on my FreeTextInvoice reports.  I'm still coming up to speed on how to be proficient with this.
 
I'm thinking it will likely go through FreetextInvoiceHeaderFooterTmp table that I already have an extension of in my own soultion, project, and model.
Would I have to create a field in my FreeTextInvoiceHeaderFooterTmp.Extension and create a relation to PurchOrderFormNum in CustInvoiceTable? 
Or do I need to add a new Dataset to my FreeTextInvoice (extended)? 
 
Sorry I know I'm 'grasping at straws' a bit here.
 
Any assistance with as much detail as you can spare would be most appreciated.
 
Best Regards,
 - Jim
  • Suggested answer
    jt1024 Profile Picture
    jt1024 452 on at
    Show PurchOrderFormNum from table CustInvoiceTable in FreeTextInvoice report?
    Hello Bharani,
     
    See earlier replies in this thread for items I created.  I didn't make any parameters.
     
    I sidestepped the problem after learning of a simpler solution from our 3rd party document reporting add on provider, Docentric. See ax. docentric. com. (remove spaces)
     
    See my post in the Docentric forum with title 'Free Text Invoice field to add to DSP/DDSP: Label: Customer requisition, Field: PurchOrderFormNum, Table: CustInvoiceTable'
     
    Best Regards.
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,605 Super User 2024 Season 1 on at
    Show PurchOrderFormNum from table CustInvoiceTable in FreeTextInvoice report?
    Have you added any new parameters in the report? If you have already a design and try to add new parameters and if you try to restore and deploy report then this error will come. You need to edit the report XML file for this.
     
    But when I see your comment that you haven't changed anything on design, how did you add this new field? Can you give the complete steps what have you did till now?
  • jt1024 Profile Picture
    jt1024 452 on at
    Show PurchOrderFormNum from table CustInvoiceTable in FreeTextInvoice report?
    Update:
    Found similar post at:
     
    https://community.dynamics.com/forums/thread/details/?threadid=3663e388-f818-4e97-8831-d940ecd77489
     
    which goes to:
     
    https://daxonline.org/1708-the-number-of-defined-parameters-is-not-equal-to-the-number-of-cell-definitions-in-the-parameter-panel.html
     
    and I did find a parameter duplication:
    SuppressDepreciationOfPaymentsSeciton
    SuppressDepreciationOfPaymentsSeciton1
     
    Result: Now only 1 error!
    Severity    Code    Description    Project    File    Line    Suppression State
    Error        Path: [AxReport/WWIFreeTextInvoice]:"An unhandled exception was thrown while validating WWIFreeTextInvoice with callstack System.InvalidOperationException: Sequence contains no matching element
       at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
       at Microsoft.Dynamics.AX.Metadata.Extensions.Reports.AxReportDataSetParameterExtensions.GetAssociatedReportParameter(AxReportDataSetParameter datasetParameter, AxReport report)
       at Microsoft.Dynamics.AX.Metadata.Validation.DataSetParameterConstraint.Validate(ModelValidationContext context, AxReportDataSetParameter element)
       at Microsoft.Dynamics.AX.Metadata.Validation.AxReportValidator.ValidateDataSets(AxReport report, ModelValidationContext validationContext)
       at Microsoft.Dynamics.AX.Metadata.Validation.AxReportValidator.DoValidate(AxReport report, Uri uri, IMetadataProvider metadataProvider, IDiagnosticSink diagnostics)
       at Microsoft.Dynamics.AX.Metadata.Validation.ValidatorBase`1.StartValidation(T objectToValidate, Uri uri, IMetadataProvider metadataProvider, IDiagnosticSink diagnostics)."    WWIFinance (CUS) [WWIFinance]    K:\AosService\PackagesLocalDirectory\WWIFinance\WWIFinance\AxReport\WWIFreeTextInvoice.xml    0    
     
    Looking for clues about the error in this one above now. Anyone know about this?
    An unhandled exception was thrown while validating WWIFreeTextInvoice with callstack System.InvalidOperationException: Sequence contains no matching element
    at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
     
    - Jim
     
  • jt1024 Profile Picture
    jt1024 452 on at
    Show PurchOrderFormNum from table CustInvoiceTable in FreeTextInvoice report?
    Hello Bharani and GirishS
     
    I added WWIPurchOrderFormNum field to my Table FreeTextInvoiceHeaderFooterTmp.Extension.
     
    Understanding that you observed the method protected void populateFreeTextInvoiceHeaderFooterTmp(CustInvoiceJour _custInvoiceJour, CompanyInfo _companyInfo) is already receiving a CustInvoiceJour object. I see the suggestion to use _custInvoiceJour.custInvoiceTable().PurchOrderFormNum to obtain the data from the CustInvoiceTable buffer.
     
    To support this I dug into some of the core code (that we don't edit..) and I found the link between 'PurchOrderFormNum' from CustInvoiceTable to CustInvoiceJour: In CustInvoiceJour there is field "PurchaseOrder" with EDT: CustPurchaseOrder and in the Code for CustInoviceJour I see: this.PurchaseOrder = _custInvoiceTable.PurchOrderFormNum;
     
    I tried the steps GirishS mentioned, and used this assignment statement in my WWIFreeTextInvoiceDP_Extension class:
    freeTextInvoiceHeaderFooterTmp1.WWIPurchOrderFormNum = _custInvoiceJour.custInvoiceTable().PurchOrderFormNum;
     
    But when I do 'deploy reports' the following errors are reported:
    Severity    Code    Description    Project    File    Line    Suppression State
    Error        An error occurred while deploying the report WWIFreeTextInvoice.Report, WWIFinance.
    This might be because the SQL Server Reporting Services has not been installed, or is not configured correctly.            0    
    Error        An error occurred while deploying the report WWIFreeTextInvoice.ReportCopy2, WWIFinance.
    This might be because the SQL Server Reporting Services has not been installed, or is not configured correctly.            0    
    Error        The number of defined parameters is not equal to the number of cell definitions in the parameter panel.
       at Microsoft.ReportingServices.Library.ReportingService2005Impl.CreateReport(String Report, String Parent, Boolean Overwrite, Byte[] Definition, Property[] Properties, Guid batchId, Warning[]& Warnings)
       at Microsoft.ReportingServices.WebServer.ReportingService2005.CreateReport(String Report, String Parent, Boolean Overwrite, Byte[] Definition, Property[] Properties, Warning[]& Warnings)            0    
    Error        An error occurred while deploying the report WWIFreeTextInvoice.ReportCopy1, WWIFinance.
    This might be because the SQL Server Reporting Services has not been installed, or is not configured correctly.            0    

    Looking a little closer at the error messages, I see it's referring to all three designs in the WWIFreeTextInvoice Report.  But what I don't get is I didn't edit the report designs?
    But I did forget to do a Full Database synchronization.  After I ran that.. and my dev system still says "Unable to find the report design WWIFreeTextInvoice.Report."

    Frustrating.
    I'm not sure how to fix that.
     
    Anyone have any idea of what I might be missing or have messed up? 
  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    Show PurchOrderFormNum from table CustInvoiceTable in FreeTextInvoice report?
    Hi Jim,
     
    No need to define relation as it is temporary table.
    You need to duplicate the SSRS report.
    After that you need to create controller class and map the new report.
    Extend the FreetextInvoiceHeaderFooterTmp  table and add the new fields.
    Now restore the dataset new field will get added to the report dataset.
    Coming to the dp class, what you have done is correct. You need to create COC for populateFreeTextInvoiceHeaderFooterTmp.
    In the method argument you have CustInvoiceJour - Using this you can get the CustInvoiceTable buffer.
    _custInvoiceJour.custInvoiceTable().PurchOrderFormNum;
    No need to create a new buffer for "FreeTextInvoiceHeaderFooterTmp" - Use the same buffer used in the standard class.
     
    Thanks,
    Girish S.
     
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,605 Super User 2024 Season 1 on at
    Show PurchOrderFormNum from table CustInvoiceTable in FreeTextInvoice report?
    Assuming you have added a new custom field via extension of that temp table, if you see in the dp class method, you have already got CustInvoiceJour buffer. So using this, write a select statement to get CustInvoiceTable buffer. From that you can pick the value whatever you required.
  • jt1024 Profile Picture
    jt1024 452 on at
    Show PurchOrderFormNum from table CustInvoiceTable in FreeTextInvoice report?
    Hello Andre,
     
    Thanks for replying to my post.
     
    The example at https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/analytics/expand-app-suite-report-data-sets step 10: "Add X++ business logic to populate the custom field data". Seems to be the equivalent step that I need to perform, but my use case is a bit different and I'm still early in my x++ programming learning curve so I'm not seeing how I would mimic this for my use case.
     
    I'm trying to get the 'Customer requisition' data stored in field PurchOrderFormNum in the CustInvoiceTable to come through to the FreeTextInvoiceDP class to get to the FreeTextInvoice report.
     
    I think due to work done before my time in this role the necessary objects are already in place: (WWI is the company name acronym used on most of our customizations.)
    - Table Extension: FreeTextInvoiceHeaderFooterTmp.Extension
    - Class: WWIFreeTextInvoiceController
    - Class: WWIFreeTextInvoiceDP_Extension
    - Report: WWIFreeTextInvoice
     
    In Class: WWIFreeTextInvoiceDP_Extension I see:
     
    [ExtensionOf(classStr(FreeTextInvoiceDP))]
    final class WWIFreeTextInvoiceDP_Extension
    {
        /// <param name="_custInvoiceJour">
        /// The <c>CustInvoiceJour</c> record that has the invoice header information.
        /// </param>
        /// <param name="_companyInfo">
        /// The <c>CompanyInfo</c> record that has the company information.
        /// </param>
        protected void populateFreeTextInvoiceHeaderFooterTmp(CustInvoiceJour _custInvoiceJour, CompanyInfo _companyInfo)
        {
            FreeTextInvoiceHeaderFooterTmp  freeTextInvoiceHeaderFooterTmp1;
    
            next populateFreeTextInvoiceHeaderFooterTmp(_custInvoiceJour,_companyInfo);
    
            freeTextInvoiceHeaderFooterTmp1 = freeTextInvoiceHeaderFooterTmp;
    
            if (_custInvoiceJour)
            {
                LogisticsPostalAddress postalAddress;
                postalAddress = LogisticsPostalAddress::findRecId(_custInvoiceJour.InvoicePostalAddress);
                freeTextInvoiceHeaderFooterTmp1.WWIInvoicingCountryRegionId = postalAddress.CountryRegionId;
            }
    
            freeTextInvoiceHeaderFooterTmp = freeTextInvoiceHeaderFooterTmp1;
        }
    
    }
     
    If I am understanding things correctly I need to modify this Class: WWIFreeTextInvoiceDP_Extension to bring in that 'Customer requisition' data stored in field PurchOrderFormNum in the CustInvoiceTable using this DP class.  
    Do I have that correct?  If so how would I do this?
     
    Thanks again for any guidance you can provide.
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,269 Super User 2024 Season 2 on at
    Show PurchOrderFormNum from table CustInvoiceTable in FreeTextInvoice report?
    Hi Jim,
     
    There is some good documentation on Microsoft Learn how to approach this: Expand Application Suite report data sets - Finance & Operations | Dynamics 365 | Microsoft Learn
    When creating the extension field on the temporary table, you don't need to create a relation. You need to fill the field with an extension on the report data provider class.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans