class PurchTableFormEventHandler
{
[FormDataSourceEventHandler(formDataSourceStr(PurchTable, PurchTable), FormDataSourceEventType::Activated)]
public static void PurchTable_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
FormRun formRun = sender.formRun();
FormRun element = sender.formRun();
FormControl yourcontroller = element.design(0).controlName("yourcontrollerName");
FormDataSource PurchTable_ds = formRun.dataSource(formDataSourceStr(PurchTable, PurchTable));
PurchTable PurchTable ;
PurchTable = PurchTable_ds.getFirst(true) ? PurchTable_ds.getFirst(true) : PurchTable_ds.cursor();
while(purchTable)
{
if(purchTable.DocumentState == VersioningDocumentState::Confirmed &&
purchTable.PurchStatus != PurchStatus::Canceled)
{
yourcontrollerName.enabled(true);
}
else
{
yourcontrollerName.enabled(false);
break;
}
purchTable = PurchTable_ds.getNext() as PurchTable;
}
}
}