28.10.2006, 16:40
|
#1
|
Участник
|
Fred Shen: Always use recId to know if a select statement returns a record
Источник: http://fredshen.spaces.live.com/Blog...E4E3!161.entry
==============
In Axapta, there are two options to know if a select statement returns a record.
Option 1:
select purchTable where
purchTable.purchId == "Do not exist";
if (purchTable)
{
…//Your logic here
}
Option 2:
select purchTable where
purchTable.purchId == "Do not exist";
if (purchTable.recId)
{
…//Your logic here
}
It is strongly recommended to use recId. Because when working with aggregate functions in select statement. Table reference will always exist no matter a record is returned or not, but recId will be 0.
e.g.
select count(purchId) purchTable where
purchTable.purchId == "Do not exist";
if (purchTable)
{
info("The record exists!");
}
It will present the user "The record exist!" even there is no record returned.
==============
Источник: http://fredshen.spaces.live.com/Blog...E4E3!161.entry
|
|