Sample Contract Class With Validation FromDate ToDate Prameters of report X++ Finance and Operations Dynamics AX
//Code published by bc_nav_expert
public class MZNUKCentralPoolReportContract
{
TransDate FromDate, ToDate;
ProjId project;
Purpose purpose;
Integer franchises;
[DataMemberAttribute("FromDate"),
sysoperationlabelAttribute(literalstr("From Date"))]
public TransDate parmFromDate( TransDate _FromDate = FromDate)
{
FromDate = _FromDate;
return FromDate;
}
[DataMemberAttribute("ToDate"),
sysoperationlabelAttribute(literalstr("ToDate"))]
public ToDate parmToDate( ToDate _ToDate = ToDate)
{
ToDate = _ToDate;
return ToDate;
}
[DataMemberAttribute("Project"),
sysoperationlabelAttribute(literalstr("Project"))]
public ProjId parmProject( ProjId _project = project)
{
project = _project;
return project;
}
[DataMemberAttribute("Purpose"),
sysoperationlabelAttribute(literalstr("Purpose"))]
public Purpose parmPurpose( Purpose _Purpose = Purpose)
{
Purpose = _Purpose;
return Purpose;
}
[DataMemberAttribute("Franchises"),
sysoperationlabelAttribute(literalstr("Franchises"))]
public Integer parmfranchises( Integer _franchises = franchises)
{
franchises = _franchises;
return franchises;
}
public boolean validate()
{
boolean isValid = true;
if (!FromDate)
{
isValid = checkFailed(strFmt("@SYS84753", "@SYS180311"));
}
if (!ToDate)
{
isValid = checkFailed(strFmt("@SYS84753", "@SYS180217"));
}
if (FromDate > ToDate)
{
isValid = checkFailed(strFmt("@SYS300457", date2StrUsr(FromDate, DateFlags::FormatAll), date2StrUsr(ToDate, DateFlags::FormatAll)));
}
return isValid;
}
}
{
TransDate FromDate, ToDate;
ProjId project;
Purpose purpose;
Integer franchises;
[DataMemberAttribute("FromDate"),
sysoperationlabelAttribute(literalstr("From Date"))]
public TransDate parmFromDate( TransDate _FromDate = FromDate)
{
FromDate = _FromDate;
return FromDate;
}
[DataMemberAttribute("ToDate"),
sysoperationlabelAttribute(literalstr("ToDate"))]
public ToDate parmToDate( ToDate _ToDate = ToDate)
{
ToDate = _ToDate;
return ToDate;
}
[DataMemberAttribute("Project"),
sysoperationlabelAttribute(literalstr("Project"))]
public ProjId parmProject( ProjId _project = project)
{
project = _project;
return project;
}
[DataMemberAttribute("Purpose"),
sysoperationlabelAttribute(literalstr("Purpose"))]
public Purpose parmPurpose( Purpose _Purpose = Purpose)
{
Purpose = _Purpose;
return Purpose;
}
[DataMemberAttribute("Franchises"),
sysoperationlabelAttribute(literalstr("Franchises"))]
public Integer parmfranchises( Integer _franchises = franchises)
{
franchises = _franchises;
return franchises;
}
public boolean validate()
{
boolean isValid = true;
if (!FromDate)
{
isValid = checkFailed(strFmt("@SYS84753", "@SYS180311"));
}
if (!ToDate)
{
isValid = checkFailed(strFmt("@SYS84753", "@SYS180217"));
}
if (FromDate > ToDate)
{
isValid = checkFailed(strFmt("@SYS300457", date2StrUsr(FromDate, DateFlags::FormatAll), date2StrUsr(ToDate, DateFlags::FormatAll)));
}
return isValid;
}
}
Read how to make UIBuilder Class Click Here
Read how to make DP class for Contact Click Here
DP Class for UI Builder ListEnumerator d365 x++ Finance and Operations
DP Class for UI Builder ListEnumerator d365 x++ Finance and Operations
No comments:
Post a Comment