Find() Method in X++
How to write Find() Method :
static AX_Student find(AX_StudentID _studentId,
boolean _forUpdate = false)
{
AX_Student newStudent;
if (_studentId)
{
if (_forUpdate)
{
newStudent.selectForUpdate(_forUpdate);
}
select firstonly newStudent
index hint StudentId
where newStudent.AX_StudentID == _studentId;
}
return newStudent;
}
you can also add more parameters in Find Method.
static AX_StudentCourse find(AX_StudentID _studentId, AX_CourseId _courseId,
boolean _forUpdate = false)
{
AX_StudentCourse newStudent;
if (_studentId, _courseId)
{
if (_forUpdate)
{
newStudent.selectForUpdate(_forUpdate);
}
select firstonly newStudent
//index hint StudentId where newStudent.AX_StudentID == _studentId
&& newStudent.AX_CourseId == _coourseId;
}
return newStudent;
}
static AX_Student find(AX_StudentID _studentId,
boolean _forUpdate = false)
{
AX_Student newStudent;
if (_studentId)
{
if (_forUpdate)
{
newStudent.selectForUpdate(_forUpdate);
}
select firstonly newStudent
index hint StudentId
where newStudent.AX_StudentID == _studentId;
}
return newStudent;
}
you can also add more parameters in Find Method.
static AX_StudentCourse find(AX_StudentID _studentId, AX_CourseId _courseId,
boolean _forUpdate = false)
{
AX_StudentCourse newStudent;
if (_studentId, _courseId)
{
if (_forUpdate)
{
newStudent.selectForUpdate(_forUpdate);
}
select firstonly newStudent
//index hint StudentId where newStudent.AX_StudentID == _studentId
&& newStudent.AX_CourseId == _coourseId;
}
return newStudent;
}
Comments
Post a Comment