9 Aralık 2013 Pazartesi

AXAPTA - Default Currency and Language

    custTable.Currency   = CompanyInfo::standardCurrency();
    custTable.LanguageId = Companyinfo::languageId();

AXAPTA - Change Company

        Header.parmShippingDateRequested(this.ShippingDateRequested);
    changecompany(TargetCompanyId)
    {
        Header.parmQuotationId();
        Header.parmCurrencyCode(CompanyInfo::standardCurrency());

        ...
        Header.save();
    }

28 Kasım 2013 Perşembe

AXAPTA - Drop-down to table's container field at form

public void dropFile(str _FileName)
{
    BinData p = new BinData();
    ;
    super(_FileName);
    p.loadFile(_FileName);
    PRTSecondHandTractorStock.Picture = p.getData();
    element.redraw();
}

21 Kasım 2013 Perşembe

AXAPTA - Make a table field works cross-company


I learned this way from a forum . You have to just create a relation like up and care about extended data type of related fields. After that you won't need a custom lookup or supress validate method at forms. It works at AX 2009, I had no change to test with 2012.

AXAP - Cross company lookup

public void lookup(FormControl _formControl, str _filterStr)
{

      CustTable   custTable;    
      Query                   Query  = new Query();
      QueryBuildDataSource    qbds;
      SysTableLookup          SysTableLookup  =      
            SysTableLookup::newParameters(TableNum(CustTable), _formControl);
    ;
    super(_formcontrol,_filterstr);

    Query.allowCrossCompany(true);      
    Query.addCompanyRange(myTable.Company);
    qbds           = Query.addDataSource(TableNum(CustTable));
    SysTableLookup.addLookupfield(FieldNum(CustTable, AccountNum), true);      

    SysTableLookup.addLookupfield(FieldNum(CustTable, Name));
    SysTableLookup.parmQuery(Query)

    SysTableLookup.performFormLookup();
}


Don't forget to supress control's validate method!..

18 Kasım 2013 Pazartesi

AXAPTA - Skip some combobox enum items

I found the solution from a forum:

This code part should write after control's Enter methods super keyword:

    this.delete(enum2str(DTSSHOperationLineType::Part));
    this.delete(enum2str(DTSSHOperationLineType::ExternalPart));


Don't forget to set AutoDataGroup = No if control is under a parent datagroup.

14 Kasım 2013 Perşembe

AXAPTA - fast search with grid

Do not use find method for this, it works so slow with big tables. This's the way which Axapta uses with it's own forms:
 element.args().lookupField(fieldnum(SMAServiceOrderTable, ServiceOrderId));
element.args().lookupValue(_myServiceOrderId);
SMAServiceOrderTable_ds.executeQuery();