Показать сообщение отдельно
Старый 24.10.2008, 10:57   #1  
Lemming is offline
Lemming
Участник
Аватар для Lemming
 
1,144 / 343 (14) ++++++
Регистрация: 20.04.2004
Адрес: Москва, Чайнатаун в Люблино
Записей в блоге: 10
? Помещение временной таблицы в Map
Собственно сабж...Требуется хранить в структуре Map временные таблицы. Просто так ее туда не положить, однако обходной путь вроде бы нашелся. Создал класс обертку

X++:
class TmpTable4CollectionStruct
{
    Common      common;
}
void new(Common     _common)
{
    ;
    //common.setTmp();

    common = _common;
}
Common getCommon()
{
    ;

    return common;
}
И собственно Job-ик для проверки.

X++:
static void Test(Args _args)
{
    LedgerTable                 ledgerTable;
    LedgerTable                 tmpLedgerTable;

    LedgerTable                 tmpLedgerTableFromMap;

    Map                         map = new Map(Types::Integer, Types::Class);

    TmpTable4CollectionStruct   struct,
                                struct2;
    int                         i;
    ;
 

    tmpLedgerTable.setTmp();


    while select ledgerTable
        order by AccountNum
    {
        buf2buf(ledgerTable, tmpLedgerTable);
        tmpLedgerTable.insert();

        i++;

        if (i > 10) break;
    }
    info("Tmp");

    while select tmpLedgerTable
        info(strfmt("%1 -> %2", tmpLedgerTable.AccountNum, tmpLedgerTable.AccountName));

    struct = new TmpTable4CollectionStruct(tmpLedgerTable);



    map.insert(1, struct);

   
    struct2 = map.lookup(1);

    // tmpLedgerTableFromMap.setTmp();
    tmpLedgerTableFromMap = struct2.getCommon();

    info("FromMap");

    while select tmpLedgerTableFromMap
        info(strfmt("%1 -> %2", tmpLedgerTableFromMap.AccountNum, tmpLedgerTableFromMap.AccountName));



}
Вроде бы то, что надо(на практике вся задумка еще не эксплуатировалась), однако хотелось бы узнать, можно ли как-то по другому, без класса обертки помещать собранные временные таблицы в Map!?!

p.s. DAX 4