Thursday, September 15, 2022

Enable/Disable form control based on multiple rows select

 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;

        }        

    }

}

update_recordset with joins

 update_recordset with joins update_recordSet storeTransfer         setting      TransactionId = transfertable.TransferId     join transfert...