Friday, 3 February 2017

validations for date ranges(fromdate and todate) in ssrs report

validations for date ranges(fromdate and todate) in ssrs report .That date ranges are

report parameters and we will give the dates dynamically. So I want to do like this,

"fromdate "  should be less than "todate" and "todate" should be greater than

"fromdate".




 Create Contract class

[

DataContractAttribute,

SysOperationContractProcessingAttribute(classStr(SL_SimpleDateLookUIBuilder),

SysOperationDataContractProcessingMode::CreateUIBuilderForRootContractOnly),

]

class SL_SimpleDateLookContract  implements SysOperationValidatable

{

StartDate                   startDate;

EndDate                     endDate;

}

we need to create the parm method in the contract class.

2: Create parmStartDate Method

[

DataMemberAttribute(‘startDate’),

]

public StartDate parmStartDate(StartDate _fromDate = startDate)

{

startDate = _fromDate;

return startDate;

}

3: Create parmEndDate Method

[

DataMemberAttribute(‘endDate’),

]

public EndDate parmEndDate(EndDate _toDate = endDate)

{

endDate = _toDate;

return endDate;

}

4: Create Validate method

validation for check correct date

/// <summary>

/// Validates the SSRS report parameters.

/// </summary>

/// <returns>

/// true if successful; otherwise, false.

/// </returns>

public boolean validate()

{

boolean ret = true;

if (startDate && endDate

&& (startDate > endDate))

{

ret = checkFailed(“@SYS16982”);

}

return ret;

}
remove UI builder code