Create button for filter advance in form axapta 4.0

Create button for filter advance in form axapta 4.0

Trainee: Song Thanh Nghia


void clicked()
{
    SCA_ManualTransfer               manualTransfer;
    InventJournalTable               inventJournal;
    Query                   query = new Query();
    QueryRun                queryRun;
    QueryBuildDataSource    qbd;

    QueryBuildRange         range;
    QueryBuildRange         qbrTransportCompany;
    int                     cntManual, cntInvent,  i;
    ;

    SCA_ManualTransfer_ds.query().dataSourceName("SCA_ManualTransfer").clearRanges();
    InventJournalTable_ds.query().dataSourceName("InventJournalTable").clearRanges();

    queryRun = new QueryRun(querystr(sca_internalTransfer));

    if(queryRun.prompt())
    {
        cntManual = queryRun.query().dataSourceTable(tablenum(SCA_ManualTransfer)).rangeCount();
        for ( i = 1 ; i <= cntManual ; i++ )
        {
            range = queryRun.query().dataSourceTable(tablenum(SCA_ManualTransfer)).range(i);
            info(strfmt("Range Field %1, Value %2",range.AOTname(),range.value()));
            SCA_ManualTransfer_ds.query().dataSourceName("SCA_ManualTransfer").addRange(fieldName2Id(tableName2Id('SCA_ManualTransfer'), range.AOTname())).value(range.value());
        }

        cntInvent = queryRun.query().dataSourceTable(tablenum(InventJournalTable)).rangeCount();
        for ( i = 1 ; i <= cntInvent ; i++ )
        {
            range = queryRun.query().dataSourceTable(tablenum(InventJournalTable)).range(i);
            info(strfmt("Range Field %1, Value %2",range.AOTname(),range.value()));
            InventJournalTable_ds.query().dataSourceName("InventJournalTable").addRange(fieldName2Id(tableName2Id('InventJournalTable'), range.AOTname())).value(range.value());
        }
    }
    //SCA_ManualTransfer_ds.executeQuery();
    //InventJournalTable_ds.executeQuery();

    element.reFilter();
    VTVUtil::refreshFormDS(SCA_ManualTransfer_ds);
    VTVUtil::refreshFormDS(InventJournalTable_ds);
    super();
}
Previous Post
Next Post

post written by: