FormDataSource with TempDB table.


22/09/2020- duocnt    764 Views    

MÔ TẢ

    1 - Viết phương thức để tạo dữ liệu choTable TempDB (populateData()).
    2 - Trong phương thức init() của Datasource mà sử dụng TempDB table thực hiện:
        2.1 - Gọi phương thức populateData().
        2.2 - Gọi phương thức linkPhysicalTableInstance() (phương thức này của AX) của TempDB Table.


LƯU Ý.

 - Muốn display dữ liệu lên Grid, thì phải chọn DataSource cho Grid, nếu không chọn Gird chỉ có thể hiển thị 1 record.


THỰC HIỆN.

1 - Phương thức tạo data cho table TempDB.

    public static MatchToInternalTransferBookLine populateData(Set _selectedRecords)
    {
       
        SetEnumerator                   _se;
        MatchToInternalTransferBookLine _buffer;
 
        _se                 =   _selectedRecords.getEnumerator();
        delete_from _buffer;
        while(_se.moveNext())
        {
            ProdTable _proTable     =   _se.current();
            _buffer.ProductionId    =  _proTable.ProdId;
            _buffer.ItemId          =  _proTable.ItemId;
            _buffer.QtyIssue        =  _proTable.QtySched;
            _buffer.ProdPoolId      =  _proTable.ProdPoolId;
            _buffer.BOMQty          =  _proTable.QtySched;
            _buffer.SalesId         =  _proTable.RsVnRefSalesId;
            _buffer.ItemFG          =  _proTable.RsVnRefItemId;
            _buffer.insert();                   
        }            return _buffer;   
    }




2 - Overide phương thức init() của DataSource mà sử dụng table TempDB làm nguồn.



    [DataSource]
    class MatchToInternalTransferBookLine
    {
        /// <summary>
        ///
        /// </summary>
        public void init()
        {
            super();
            FormRun     _caller;
            _caller     =   element.args().caller();
            if(_caller.name() == formStr(ProdTableListPage))
            {
                _selectedRecords    =   element.args().parmObject();               
                MatchToInternalTransferBookLine.linkPhysicalTableInstance(MatchToInternalTransferBookLine::populateData(_selectedRecords));
            }
        }
 
    }



Góp ý kiến

;
;