AXForum  
Вернуться   AXForum > Прочие обсуждения > Курилка
DAX
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 08.08.2018, 13:59   #11  
Ivanhoe is offline
Ivanhoe
Участник
Аватар для Ivanhoe
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
 
4,143 / 2155 (80) +++++++++
Регистрация: 29.09.2005
Адрес: Санкт-Петербург
Это какая версия? В Dynamics AX 2012 R3 какой-то CU теперь вот так:
X++:
/// <summary>
///    Tests whether the <see cref="M:FormDataSource.findRecord" /> method can be used to find the alerted
///    record in a form data source.
/// </summary>
/// <param name="alertFds">
///    Form data source of the alerted buffer; optional.
/// </param>
/// <returns>
///    true if the <c>findRecord</c> method can be used; otherwise, false.
/// </returns>
/// <remarks>
///    If the form data source of the alerted buffer is the first one and <see
///    cref="M:EventContextInformation.canUseLookup" /> returns false, then this method returns false. If
///    the number of records in the data source is more that 100, this method returns false. Otherwise, it
///    returns true.
/// </remarks>
private boolean canUseFindRecord(
    FormDataSource          alertFds = formRun.dataSource(alertFormDsName)
    )
{
    tableId                 tableId,tableId2,childTableId;
    List                    fds2Dynas;
    ListEnumerator          fdsLe;
    Map                     dynalinkMap;
    container               dynaPack;
    MapEnumerator           dynaMe;
    Query                   q;
    QueryBuildDataSource    qbds;
    List                    keyList;
    Map                     keyFields;
    DictIndex               di;

    // If changed remember to updated the Dev. doc!
    #define.maxRecsForFind(100)

    boolean test()
    {
        // If first then lookup overrules
        if (alertQbdsNo == 1 && ! this.canUseLookup())
            return false;

        if (! alertBuffer)
            return false;

        tableId2 = alertFds.isInheritanceDataSource() && alertFds.isBaseDataSource() ?
                            alertFds.masterInheritanceDataSource().table() :
                            alertFds.table();
        q       = new Query();
        qbds    = q.addDataSource(tableId2);

        // Use packed dyna info to find dyna fields from alert buffer to parent
        if (conLen(packedDynas) > 1)
        {
            fds2Dynas   = List::create(packedDynas);
            fdsLe       = fds2Dynas.getEnumerator();
            fdsLe.moveNext();
            [tableId,childTableId,dynaPack]  = fdsLe.current();

            keyList     = new List(Types::Integer);
            dynalinkMap = Map::create(dynaPack);
            dynaMe      = dynalinkMap.getEnumerator();
            while (dynaMe.moveNext())
            {
                keyList.addEnd(dynaMe.currentKey());
            }
            keyFields = SysDictTable::mapFieldIds2Values(keyList,alertBuffer);

            // Add dyna's values as ranges
            SysQuery::addRangesFromKeyData(qbds,keyFields.pack());

            // Add filter query
            if (filterQuery)
                SysQuery::mergeRanges(q,filterQuery);
        }
        else
        {
            // When no dyna's only use filter
            if (filterQuery)
            {
                q = filterQuery;

                di = this.getPrimaryIndex();
                if (di.field(1) == fieldNum(Common,RecId))
                {
                    q.dataSourceTable(tableId2).addRange(di.field(1)).value(SysQuery::value(alertBuffer.(di.field(1))));
                }
            }
        }

        if (q && (SysQuery::countLoops(new QueryRun(q)) <= #maxRecsForFind))
        {
            return true;
        }

        return false;
    }

    if (canUseFindRecordCalled)
    {
        return canUseFindRecordValue;
    }

    canUseFindRecordValue  = test();
    canUseFindRecordCalled = true;

    return canUseFindRecordValue;
}
__________________
Ivanhoe as is..
Теги
axapta, cil, d365fo, guid, rasset, uuid, uuidv7, баг

 


Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 09:47.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.