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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Dates Validation in RDP Contract class

(0) ShareShare
ReportReport
Posted on by 636

Hi Experts,

I am trying to add a validation in my SSRS report's contract class to make sure the dates are selected properly. Below is my contract class and the methods in it. The validation is not working (Nothing happens when I select an invalid period) when I run the report ,can anyone help me with if I missed anything or what's wrong in it. 

class XYZ implements SysOperationValidatable
{
TransDate FromDate,ToDate;
}

[DataMemberAttribute('From Date'),SysOperationLabelAttribute('From date :'),SysOperationDisplayOrderAttribute('1')]

public TransDate parmFromDate(TransDate _fromDate = FromDate)
{
FromDate = _fromDate;
return FromDate;
}

[DataMemberAttribute('To Date'),SysOperationLabelAttribute('To date :'),SysOperationDisplayOrderAttribute('2')]

public TransDate parmToDate(TransDate _toDate = ToDate)
{
ToDate = _toDate;
return ToDate;

}

public boolean validate()
{
boolean IsValid = true;

if (!FromDate || !ToDate || ToDate < FromDate)
IsValid = checkFailed("Invalid Date");

return IsValid;
}

I have the same question (0)
  • Martin Dráb Profile Picture
    239,029 Most Valuable Professional on at

    Is your class really missing DataContract attribute, or did you merely share incomplete code?

    By the way, please always use Insert > Insert Code (in the rich formatting view) to paste source code. It preserves line indentation, which makes code much easier to read.

  • D365  beginner Profile Picture
    636 on at

    Hi Martin,

    Actually I missed DataContract attribute in the class. But still my problem is not solved Is there anything that I am missing with. 

    [DataContractAttribute]

    class XYZ implements SysOperationValidatable

    {

       TransDate   FromDate,ToDate;

    }

  • Martin Dráb Profile Picture
    239,029 Most Valuable Professional on at

    What did you find when you debugged your code before giving it up and coming here? Does validate() get called at all?

    By the way, you again forgot to use Insert > Insert Code. This is how it would look like:

    [DataContractAttribute]
    class XYZ implements SysOperationValidatable
    {
    	TransDate fromDate, toDate;
    
    	[
    		DataMemberAttribute('FromDate'),
    		SysOperationLabelAttribute('From date:'),
    		SysOperationDisplayOrderAttribute('1')
    	]
    	public TransDate parmFromDate(TransDate _fromDate = fromDate)
    	{
    		fromDate = _fromDate;
    		return fromDate;
    	}
    
    	[
    		DataMemberAttribute('ToDate'),
    		SysOperationLabelAttribute('To date:'),
    		SysOperationDisplayOrderAttribute('2')
    	]
    	public TransDate parmToDate(TransDate _toDate = toDate)
    	{
    		toDate = _toDate;
    		return toDate;
    	}
    
    	public boolean validate()
    	{
    		boolean isValid = true;
    
    		if (!fromDate || !toDate || toDate < fromDate)
    		{
    			isValid = checkFailed("Invalid Date");
    		}
    
    		return isValid;
    	}
    }

    I've also fixed a few things in your code.

  • Suggested answer
    Munib Qureshi Profile Picture
    10 on at

    what will be dpclass for this contract class

  • Suggested answer
    Hussien Ahmed Profile Picture
    110 on at

    Try to print or debug the parameters(from date , To date) in the DP class to make sure your contract class working fine.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 617

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 461 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 298 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans