78) COC :- how to fill the data 2nd datasource on 1st datasource refernce
I had a scenario where I need to fill the line data on the based on the header :-
Step 1 :- for this create form data source init value and pass the refernce of the first data source
/// <summary>
/// The <c>AVAEntAssetMaintenancePlanFrm_MaintenancePlanLineDS_Extension</c> contains the TransMountain extending logic for the <c>MaintenancePlanLine</c> form.
/// </summary>
[ExtensionOf(formDataSourceStr(EntAssetMaintenancePlan, MaintenancePlanLine))]
final class AvaEntAssetMaintenancePlanFrm_MaintenancePlanLineDS_Extension
{
/// <summary>
/// Handles the events raised on datasource initialization.
/// </summary>
public void initValue()
{
EntAssetMaintenancePlanLine maintenancePlanLine;
next initValue();
maintenancePlanLine = this.cursor();
maintenancePlanLine.avaInitFromMaintenancePlan(this.formRun().dataSource(formDataSourceStr(EntAssetMaintenancePlan, MaintenancePlan)).cursor());
}
}
===================================================================
Step 2 :- This method is created on the table to fill the data
/// <summary>
/// The <c>AvaEntAssetMaintenancePlanLine_Extension</c> contains the TransMountain extending logic for the <c>EntAssetMaintenancePlanLine</c> table.
/// </summary>
[ExtensionOf(tableStr(EntAssetMaintenancePlanLine))]
final class AvaEntAssetMaintenancePlanLine_Extension
{
/// <summary>
/// Initializes work order type and auto create
/// </summary>
/// <parm = _maintenancePlan></parm>
void avaInitFromMaintenancePlan(EntAssetMaintenancePlan _maintenancePlan)
{
if (_maintenancePlan.AvaIsMaintenanceProgram)
{
this.AutoCreate = NoYes::Yes;
this.WorkOrderType = _maintenancePlan.AvaMaintenanceWorkOrderType;
this.ActivityIntervalType = EntAssetMaintenancePlanLineIntervaltype::AvaFromProgram;
this.ActivityInterval = 1;
}
}
}
Comments
Post a Comment