Blog Listem

29 Kasım 2012 Perşembe

AXAPTA SysQuery ile Form ve Report'a Range Ekleme

Form için:
    SysQuery::findOrCreateRange(B_RMAOutTable_DS.query().dataSourceTable(tablenum(B_RMAOutTable)),        fieldnum(B_RMAOutTable,RMAIn)).
         value(QueryValue(NoYes::Yes));


Report için:

    SysQuery::findOrCreateRange(this.query().dataSourceTable(tablenum(SMAServiceOrderTable)),
        fieldnum(SMAServiceOrderTable,ItemSerialNum)).
 value(sysquery::valueNotEmptyString());


Run methoduna super'den önce yazabilirsiniz.

27 Kasım 2012 Salı

If ve like

Axapta'da like operatörü sadece sql - select cümleciklerinde değil, if komutunda da kullanılabilir:

if (ItemId like "WX*")

5 Kasım 2012 Pazartesi

AXAPTA - Excel Import

void clicked()
{
    SysExcelApplication application;
    SysExcelWorkbooks   workbooks;
    SysExcelWorkbook    workbook;
    SysExcelWorksheets  worksheets;
    SysExcelWorksheet   worksheet;
    SysExcelCells       cells;
    COMVariantType      type;
    int                 row;
    str                 line;
    Filename            Filename;
    ;
    super();
    Filename = WinApi::getOpenFileName(element.hWnd(),['XLS dosyaları','*.xls'],"","Serino dosyası");
    if (!Filename)
        return;

    application = SysExcelApplication::construct();
    workbooks = application.workbooks();
    try
    {
        workbooks.open(filename,0,true);
    }
    catch (Exception::Error)
    {
        throw error(strfmt("Dosya açılamıyor: %1",Filename));
    }

    element.lock();
    workbook = workbooks.item(1);
    worksheets = workbook.worksheets();
    worksheet = worksheets.itemFromNum(1);
    cells = worksheet.cells();
    do
    {
        row++;
        type = cells.item(row+1,1).value().variantType();

        switch(cells.item(row,1).value().variantType())
        {
            case COMVariantType::VT_BSTR:
                line = cells.item(row,1).value().bStr();
                break;
            case COMVariantType::VT_DECIMAL, COMVariantType::VT_R4, COMVariantType::VT_R8:
                line = strfmt("%1",any2int(cells.item(row,1).value().double()));
                break;
            case COMVariantType::VT_I1, COMVariantType::VT_I2, COMVariantType::VT_I4:
                line = strfmt("%1",cells.item(row,1).value().int());
                break;
            case COMVariantType::VT_UI1, COMVariantType::VT_UI2, COMVariantType::VT_UI4:
                line = strfmt("%1",cells.item(row,1).value().uLong());
                break;
            case (COMVariantType::VT_DATE):
                line = date2str(cells.item(row,1).value().date(),123,2,1,2,1,4);
             case COMVariantType::VT_EMPTY:
                line ="";
                break;
            default:
                line="";
}
        if (Line != "")
            element.insertSerial(line);
    }
    while (type != COMVariantType::VT_EMPTY);
    application.quit();
    element.unLock();
}