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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 25.01.2002, 08:28   #3  
slava is offline
slava
сибиряк
Самостоятельные клиенты AX
 
468 / 23 (1) +++
Регистрация: 28.12.2001
Адрес: Москва
Lightbulb Взято с technet.navision.com
Do not test for [Recid > 0] - valid Recid's may be negative as well...
Testing if a database buffer is empty can be done using the Recid column. But a little care should be taken. This article explains how.


One way to determine if a select returned a record, is to test the RecId column. Some programmers - including experienced XAL programmers - does this by testing if the column is greater than zero:

if (myTable.Recid>0) // then blah, blah,...
Still, for large amounts of data, Recid values may exceed the upper limit of a signed 32-bit long. For such high values, the Recid's in Axapta appear as negative number, thus making the above X++ construction error prone. Instead use

if (myTable.Recid) // then blah, blah,...
or

if (myTable.Recid != 0) // then blah, blah,...
One exception for this rule is, when the Recid column has been used for an aggregation such as count:

select count(Recid) from myTable; if (myTable.Recid > 0) // then blah, blah,...
since the number of records is obviously not negative.
__________________
С уважением, Вячеслав.
Теги
recid

 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
снова RecId из SQL SHiSHok DAX: Программирование 4 03.03.2009 15:13
if (record) vs if (record.RecId) kashperuk DAX: Программирование 18 27.11.2008 18:53
поля, содержащие RecId somebody DAX: Программирование 15 16.05.2008 17:50
RecID при экспорте-импорте не восстанавливаются? mazzy DAX: База знаний и проекты 14 04.02.2003 14:07
генерирование RecId Дмитрий DAX: Программирование 8 30.01.2003 13:55

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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 02:19.