Tuesday 8 September 2015

look up with the all table fields of a table in ax 2012

Please refer :

 \Classes\WrkCtrBulkEditController\init          

protected void init()
{
    FormRun             callerForm;
    FormDataSource      callerFormDataSource;
    FormDataSource      baseFormDataSource;
    DictTable           dictTable;
    fieldId             currentFieldId;
    WrkCtrBulkEditField wrkCtrBulkEditField;
    int                 dataSourceCount;
    int                 dataSourceIndex;
    int                 fieldMapKey = 0;

    if( formObject && formObject.args() )
    {
        callerForm = formObject.args().caller();
    }

    if( callerForm )
    {
        baseFormDataSource = callerForm.dataSource();

        dataSourceCount = callerForm.dataSourceCount();

        for (dataSourceIndex = 1; dataSourceIndex <= dataSourceCount; ++dataSourceIndex)
        {
            callerFormDataSource = callerForm.dataSource(dataSourceIndex);

            if (!this.isInnerJoined(baseFormDataSource, callerFormDataSource))
            {
                continue; // only process inner-joined datasources
            }

            dictTable = new DictTable( callerFormDataSource.table() );

            if (dictTable && hasTableAccess(dictTable.id()))
            {

                for( currentFieldId = dictTable.fieldNext(0); currentFieldId; currentFieldId = dictTable.fieldNext(currentFieldId) )
                {
                    wrkCtrBulkEditField = WrkCtrBulkEditField::newFromDatasourceField(callerFormDataSource, dictTable.fieldObject(currentFieldId) );

                    //if( wrkCtrBulkEditField.isEditable() )
                    {
                        fieldsMap.insert( fieldMapKey, wrkCtrBulkEditField );
                        fieldMapKey++;
                    }

                }
            }
        }
    }
}

Please debug this class and find out how the look up is getting created                                                52

No comments:

Post a Comment

intercompany PO multiple product receipt by x++

public void processStampICPO(PackingSlipId _deliveryNote,                             Transdate _deliverydate,                             ...