![]() |
#3 |
сибиряк
|
![]()
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 | 4 | |||
if (record) vs if (record.RecId) | 18 | |||
поля, содержащие RecId | 15 | |||
RecID при экспорте-импорте не восстанавливаются? | 14 | |||
генерирование RecId | 8 |
|