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

DataMemberAttribute for labeling in report contract class

(0) ShareShare
ReportReport
Posted on by

Hi all,

When creating Contract Class, I usually using this kind of parameter code :

[ DataMemberAttribute,
SysOperationLabelAttribute("Created from date"),
SysOperationDisplayOrderAttribute('1')
]
public transdate parmfromdate(Transdate _fromdate = fromdate)
{
fromdate = _fromdate;
return fromdate;
}

In the DataMemberAttribute, what is actually the difference by adding some word or leave it empty like that ? because it used to be like this ->

[ DataMemberAttribute("FromDate"),
SysOperationLabelAttribute("Created from date"),
SysOperationDisplayOrderAttribute('1')
]
public transdate parmfromdate(Transdate _fromdate = fromdate)
{
fromdate = _fromdate;
return fromdate;
}

Reason I asked is, I gotta an issue whereby the label showing when running this, is not correct, and I fixed it by changed the SysOperationLabelAttribute (I added the word 'Created' before there is no such word), but it is never reflected after Build. Some guy advice me to just leave the DataMemberAttribute to empty like the 1st one, and the label changes is reflected. BUT STRANGELY, the dialog now give me extra one parameter which has the old label, right at the end of my parameters.

How to fix this problem ?

I have the same question (0)
  • Blue Wang Profile Picture
    on at
    RE: DataMemberAttribute for labeling in report contract class

    hi Wwwong,

    Yes, you can delete the parameters that do not exist in the data set.

    Because you set the label, so it is not only a problem of the UI.

  • Community Member Profile Picture
    on at
    RE: DataMemberAttribute for labeling in report contract class

    Hi Both,

    Yeah, never occurred to me that it is bound to the report. Thought it is a UI problem. I refresh (restore) dataset, also checking the parameters. Saw that two "old" parameters then delete (I can just delete, right ?), build and deploy again.

    It works.

    Thank you so much.

  • Blue Wang Profile Picture
    on at
    RE: DataMemberAttribute for labeling in report contract class

    Hi WWwong,

    Check your parameters, It is bound to the label.

    11215.PNG

  • Community Member Profile Picture
    on at
    RE: DataMemberAttribute for labeling in report contract class

    Hi Blue,

    No, it's not about the report, but the Dialog parameter it self.

    So now, I have two Dialog field parameter instead one, 1st is with the correct labelling, and at the very end (because I have other parameters too, specified in this Report Contract Class), is the old with incorrect (old) labelling that come from nowhere.

    Thanks,

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at
    RE: DataMemberAttribute for labeling in report contract class

    Hi WWwong,

    Data contract class is used to exchange data between 2 entities (client and service for examples) by serialization and deserialization of contract class to a common format (json, xml).

    DataMemeberAttribute has one optional parameter Name, to indicate the name of the member in serialization\deserialization process. If it's empty name of the method name will be taken (without parm).

    When SSRS report generates parameters for the report object itself, it uses a contract to do it. If some parameters were changed the contract after you need to reflect these changes to SSRS report parameters as well, but refreshing data set.

    if you rename parm method (like parmTransDate -> parmFromDate) you can add custom name via DataMemberAttribute class to keep the old name and do not refresh SSRS report dataset.

    In your case, you can try to remove the custom name and refresh SSRS report dataset and check final list of parameters of data set.

  • Verified answer
    Blue Wang Profile Picture
    on at
    RE: DataMemberAttribute for labeling in report contract class

    HI WWwong,

    After you add label or change DataMemberAttribute to empty, did you refresh your dataset and deploy report again?

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,072

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 829 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans