AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX: Программирование
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 16.05.2008, 14:15   #1  
glibs is offline
glibs
Member
Сотрудники компании It Box
Most Valuable Professional
Лучший по профессии 2011
Лучший по профессии 2009
 
4,942 / 911 (40) +++++++
Регистрация: 10.06.2002
Адрес: I am from Kyiv, Ukraine. Now I am in Moscow. For private contacts: glibs@hotmail.com
Вот джоб, о котором я веду речь. Писался под 3.0. Но на 4.0, вроде, запускается.

static void findBadRefRecId(Args _args)
{
UtilElements utilElements;
DictTable dictTable;
DictField dictField;
DictType dictType;
TableName prevTable;
Counter i,
result,
fieldsFound,
tablesFound;

Boolean skipField(extendedTypeId _typeId)
{
DictType localDictType = new DictType(_typeId);
;

if (!localDictType)
{
return false;
}

switch (localDictType.id())
{
case typeId2ExtendedTypeId(typeid(recId)) :
case typeId2ExtendedTypeId(typeid(tableId)) :
case typeId2ExtendedTypeId(typeid(ParametersKey)) :
case typeId2ExtendedTypeId(typeid(classId)) :
case typeId2ExtendedTypeId(typeid(FieldNum)) :
case typeId2ExtendedTypeId(typeid(fieldId)) :
case typeId2ExtendedTypeId(typeid(FontSize)) :
case typeId2ExtendedTypeId(typeid(SessionId)) :
case typeId2ExtendedTypeId(typeid(timeOfDay)) :
case typeId2ExtendedTypeId(typeid(Days)) :
case typeId2ExtendedTypeId(typeid(WeekDay)) :
case typeId2ExtendedTypeId(typeid(InventDimFixed)) :
case typeId2ExtendedTypeId(typeid(PrintCopies)) :
case typeId2ExtendedTypeId(typeid(TaxReportField)) :
case typeId2ExtendedTypeId(typeid(JmgSeconds)) :
case typeId2ExtendedTypeId(typeid(Minutes)) :
case typeId2ExtendedTypeId(typeid(Seconds)) :
case typeId2ExtendedTypeId(typeid(Column)) :
case typeId2ExtendedTypeId(typeid(Columns)) :
case typeId2ExtendedTypeId(typeid(Yr)) :
case typeId2ExtendedTypeId(typeid(Months)) :
case typeId2ExtendedTypeId(typeid(NumberSequenceRange)) :
return true;
default :
}

if (localDictType.extend())
{
return skipField(localDictType.extend());
}
return false;

}

str typesChain(extendedTypeId _typeId)
{
DictType chainDictType = new DictType(_typeId);
str ret;
;

if (chainDictType)
{
ret = ret + strfmt(" --> %1", chainDictType.name());
}

if (chainDictType.extend())
{
ret = ret + strfmt("%1", typesChain(chainDictType.extend()));
}
return ret;

}
;

while select utilElements
order by name
where utilElements.recordType == UtilElementType::Table
{
if (prevTable != utilElements.name)
{
dictTable = new DictTable(tablename2id(utilElements.name));
if (!dictTable.isMap() && !dictTable.isView() && !dictTable.isTmp())
{
info (strfmt("%1", dictTable.name()));
tablesFound++;
result = 0;
for (i = 1; i <= dictTable.fieldCnt(); i++)
{
dictField = new DictField(dictTable.id(), dictTable.fieldCnt2Id(i));
if (dictField.baseType() == Types::Integer &&
!dictField.isSystem() && !skipField(dictField.typeId()))
{
dictType = new DictType(dictField.typeId());
info (strfmt(" %1 -- %2",
dictField.name(),
dictType ? typesChain(dictField.typeId()) : int2str(dictField.typeId())));
// if (dictType)
// {
// info (strfmt(" %1 -- %2", dictType.label(), dictType.help()));
// }
fieldsFound++;
result++;
}
}
if (!result)
{
infolog.cut(infolog.line());
tablesFound--;
}
}
}
prevTable = utilElements.name;
}
info (strfmt("Total number of tables found: %1", tablesFound));
info (strfmt("Total number of fields found: %1", fieldsFound));

}
__________________
С уважением,
glibs®
Теги
ax3.0, recid, дефрагментирование recid

 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Как выполнять дефрагментирование RecID mazzy DAX: База знаний и проекты 174 05.10.2017 12:59
Denis Fedotenko: Новые поля в складских проводках Blog bot DAX: База знаний и проекты 10 24.05.2007 11:57
aEremenko: Дефрагментация RecID Blog bot DAX Blogs 2 06.03.2007 22:25
Тип поля RecId Eldar9x DAX: Программирование 4 14.11.2006 16:03
Получить значение поля таблицы по номеру (Id) поля Anais DAX: Программирование 2 15.04.2004 13:00

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

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

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