Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / SSRS report data contr...
Finance forum
Answered

SSRS report data contract not being passed into RDP class

Posted on by 2,650

Hi,

I have built a custom SSRS report in D365 - 10.0.27.

The report runs fine and returns my data without issue.

I have a data contract in use and a data query.

[SrsReportQueryAttribute(queryStr(MyTestQuery)),
SRSReportParameterAttribute(classStr(MyTestContract))]
class MyTestRDP extends SRSReportDataProviderBase

I have the above code declared at the beginning of my RDP class - everything appears to be correct in the code but when I execute the run of the report and debug, it would appear my data query is being loaded correctly but my data contract is not present in the parmDataContract() method of the class - when I look at the rdpDataContract value, it is simply a blank version of the contract.

My report loads the parameters of the contract when the report is run via my controller class, when I debug the contract, I can see the value change when I select it - when I click on OK to run the report with the parameters in place, the contract refreshes a number of times until the code reaches the processData method of the RDP class.

public void processReport()
{
        SalesTable              salesTable;
        MyTestContract          orderContract;
        CreatedDateTime         orderCreated;
        QueryBuildDataSource    qbds;
        QueryBuildRange         qbr;


        // process range values
        orderContract = this.parmDataContract() as MyTestContract;

        orderCreated = orderContract.parmCreatedDateTime();

It is here where it is almost as if a blank or new version of the contract is initialised and my selected values are not being returned.

I am sure there is something really minor wrong, somewhere but if someone could advise me on where to look that would be great.

Thanks

  • Alex VN Profile Picture
    Alex VN 1,992 on at
    RE: SSRS report data contract not being passed into RDP class

    Hi,

    Glad that my solution helps. If you want to be blank or multiple, I think that seems to be SSRS problem.

    You might check this article and see if can applied. Also you can consider to make data in table converted to string "Null" so it can be an option as well.

  • Kauto Profile Picture
    Kauto 2,650 on at
    RE: SSRS report data contract not being passed into RDP class

    Hi Alex

    Sorry this is now working and I can see the extra parameters from my contract in the report. I did have to create a new design after I did this because the report didn't deploy.

    I have a query about the new report parameters that get created.

    If I have warehouse set as a parameter and I want to be able to add multiple values but I also want to be able to leave it blank what setup do I set on the report parameter?

    pastedimage1660918523262v1.png

    Thanks

  • Kauto Profile Picture
    Kauto 2,650 on at
    RE: SSRS report data contract not being passed into RDP class

    Hi Alex

    The custom parameters from the contract are not present under the DATASETS - datasource table - Parameters area - the only ones present there are the default ones

    pastedimage1660905476384v1.png

    Like I have said - when the code reaches the processReport method of the data provider class, the contract is empty.

    The contract loads when the report controller is called and I am able to select the parameter value, however it is lost in passing between this point and the processReport method in RDP

    If someone has experienced this issue before please let me know as it is extremely frustrating and I can't find where it is being lost in debugging.

     

  • Verified answer
    Alex VN Profile Picture
    Alex VN 1,992 on at
    RE: SSRS report data contract not being passed into RDP class

    Hi,

    Can you check on the report to see if the CreatedDateTime parameter has been added to the report?

    If not, please help to right click on the report dataset - restore so it can auto add the parameter for you. Then you can do build and deploy to report server, restart SQL reporting service to test further.

    Thank you.

  • Kauto Profile Picture
    Kauto 2,650 on at
    RE: SSRS report data contract not being passed into RDP class

    Hi Judy

    Here is the code from the contract

    /// 
    /// Data Contract class for mytest report
    /// 
    [DataContractAttribute]
    public class MyTestContract
    {
        str                 packedQuery;
        CreatedDateTime     orderCreated;
        NoYesId             dontProcess;
        InventLocationId    warehouse;
        InventSiteId        site;
    
        [DataMemberAttribute('CreatedDateTime'),
        SysOperationLabelAttribute(literalstr("Order Created DateTime")),
        SysOperationDisplayOrderAttribute('1')]
        public CreatedDateTime parmCreatedDateTime(CreatedDateTime _orderCreated = orderCreated)
        {
            orderCreated = _orderCreated;
    
            return orderCreated;
        }
    }

    At this stage I am at a complete loss.

    I know code similar to this works fine AX 2012 R3, but I built my contract class, my RDP class and my controller class all via the text book example.

  • Verified answer
    huijij Profile Picture
    huijij 19,809 on at
    RE: SSRS report data contract not being passed into RDP class

    Hi Kauto,

    Suggest you go over and check your constract class if the 'DataContractAttribute' and 'DataMemberAttribute ' are mentioned at the beginning of the 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

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,782 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,067 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,150

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans