Hi All,
I have read the implementations for SysOperationInitializable (to initialize parameters), SysOperationValidatable (to validate parameters).
I want to set the FromDate and ToDate to certain values based on Today().
The SysOperationValidatable works.
I am not able to get SysOperationInitializable to work. The code does not seem to execute the Initialize ( ) Method. What am I missing ?
The code is below. I know this has been discussed long time back, but I cannot get the code in Initialize ( ) to execute.
ClassDeclaration
[DataContractAttribute]
class BM_072_Contract implements SysOperationInitializable, SysOperationValidatable
{
BaseDate FromDate, ToDate;
}
Initialize ( )
public void initialize()
{
FromDate = systemDateGet() - 40;
ToDate = systemDateGet() - 10;
}
[DataMemberAttribute("From Date"),
SysOperationLabelAttribute("From Date"),
SysOperationDisplayOrderAttribute('1')]
public BaseDate ParmFromDate(FromDate _FromDate = FromDate)
{
FromDate = _FromDate;
return FromDate;
}
[DataMemberAttribute("To Date"),
SysOperationLabelAttribute("To Date"),
SysOperationDisplayOrderAttribute('2')]
public BaseDate ParmToDate(ToDate _ToDate = ToDate)
{
ToDate = _ToDate;
return ToDate;
}
public boolean validate()
{
//Validate the input parameters.
boolean isValid = true;
if (!FromDate)
{
isValid = checkFailed("From Date should be entered");
}
if (!ToDate)
{
isValid = checkFailed("To Date should be entered");
}
if (isValid && (FromDate > ToDate))
{
isValid = checkFailed(strfmt("From Date should be less than or equal to To Date",
date2StrUsr(fromDate, DateFlags::FormatAll), date2StrUsr(toDate, DateFlags::FormatAll)));
}
return isValid;
}