Skip to main content

Notifications

Announcements

No record found.

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 592

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;
}

  • Suggested answer
    Hussien Ahmed Profile Picture
    110 on at
    RE: Dates Validation in RDP Contract class

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

  • Suggested answer
    Munib Qureshi Profile Picture
    10 on at
    RE: Dates Validation in RDP Contract class

    what will be dpclass for this contract class

  • Martin Dráb Profile Picture
    233,009 Most Valuable Professional on at
    RE: Dates Validation in RDP Contract class

    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.

  • D365  beginner Profile Picture
    592 on at
    RE: Dates Validation in RDP Contract class

    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
    233,009 Most Valuable Professional on at
    RE: Dates Validation in RDP Contract class

    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.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,261 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,009 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans