76) COC - Create a COC of the form data source INIt menthod
/// <summary>
/// The <c>AvaEntAssetWorkOrderChecklistFrm_WorkOrderLineChecklistDS_Extension</c> contains the TransMountain extending logic for the <c>EntAssetWorkOrderChecklist</c> form and <c>WorkOrderLineChecklist</c> datasource.
/// </summary>
[ExtensionOf(formDataSourceStr(EntAssetWorkOrderChecklist, AvaWorkOrderTable))]
final class AvaEntAssetWorkOrderChecklistFrm_AvaWorkOrderTableDS_Extension
{
public void init()
{
FormDataSource avaWorkOrderLineChecklistHeaderDS = element.dataSource(formDataSourceStr(EntAssetWorkOrderChecklist, AvaWorkOrderLineChecklistHeader));
if (element.parmIsAvaCustomForm())
{
avaWorkOrderLineChecklistHeaderDS.linkType(FormLinkType::InnerJoin);
}
next init();
if (element.parmIsAvaCustomForm())
{
Query query = this.query();
FormDataSource avaWorkOrderLineDS = element.dataSource(formDataSourceStr(EntAssetWorkOrderChecklist, AvaWorkOrderLine));
QueryBuildDataSource qbdsAvaWorkOrderLine = avaWorkOrderLineDS.queryBuildDataSource();
FormDataSource avaWorkOrderLineChecklistDS = element.dataSource(formDataSourceStr(EntAssetWorkOrderChecklist, WorkOrderLineChecklist));
QueryBuildDataSource qbdsWorkOrderLineChecklist = avaWorkOrderLineChecklistDS.queryBuildDataSource();
QueryBuildRange qbRange = qbdsAvaWorkOrderLine.addRange(fieldNum(EntAssetWorkOrderLine, WorkOrder));
if (element.parmCallerWorkOrderTable())
{
qbRange.value(queryValue(element.parmCallerWorkOrderTable().RecId));
}
else
{
qbRange.value(queryValue(-1));
}
qbdsAvaWorkOrderLine.addOrderByField(fieldNum(EntAssetWorkOrderLine, LineNumber));
qbdsWorkOrderLineChecklist.addOrderByField(fieldNum(EntAssetWorkOrderLineCheckList, ExternalLineNum));
}
}
public void initValue()
{
next initValue();
if (element.parmIsAvaCustomForm())
{
var workorderlineDS = this.formRun().dataSource(formDataSourceStr(EntAssetWorkOrderChecklist, WorkOrderLine)) as FormDataSource;
var workOrderLine = workorderlineDS.cursor() as EntAssetWorkOrderLine;
var workorderTableDS = this.formRun().dataSource(formDataSourceStr(EntAssetWorkOrderChecklist, AvaWorkOrderTable)) as FormDataSource;
var avaWorkOrderTable = workorderTableDS.cursor() as EntAssetWorkOrderTable;
avaWorkOrderTable.data(workOrderLine.workOrderTable());
workorderTableDS.rereadReferenceDataSources();
}
}
}
Comments
Post a Comment