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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 07.06.2011, 19:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,644 / 848 (80) +++++++
Регистрация: 28.10.2006
daxline: rowCount() method on table buffers.
Источник: http://feedproxy.google.com/~r/blogs...e-buffers.html
==============

At first glance, this method looks like that it will return the number of rows selected on a table. But that is not the case. If we run the following lines, the result will be always -1

select custTable where custTable.custGroup=='10';
print custTable.rowCount();

The issue is that this method is to be used only with set based operations on the database. So, if you are using insert_recordset, update_recordset or delete_from, the rowCount() method will return the number of rows created, updated or deleted. Here is a sample job that shows this in action.

X++:
static void rowCountJob(Args _args)
{
CustTable custTable;
MyTable myTable;
;
ttsbegin;

insert_recordset myTable(AccountNum, PartyId, CustGroup, Currency)
select AccountNum, PartyId, CustGroup, Currency
from custTable
where custTable.CustGroup== '10';

// Prints 13 as 13 records with custGroup == 10 were inserted from CustTable
print myTable.RowCount();

update_recordset myTable
setting Currency='CNY'
where myTable.AccountNum like '11*';

// Prints 4 as 4 record exists( 1101, 1102, 1103, 1104)
print myTable.RowCount();

delete_from myTable
where myTable.AccountNum like '9*';

// Prints 1 as 1 record exists (9024)
print myTable.RowCount();

delete_from myTable;

// Prints 12 as 12 records are all that exists.
print myTable.RowCount();
ttscommit;

pause;
}
Источник: http://feedproxy.google.com/~r/blogs...e-buffers.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.

Последний раз редактировалось Poleax; 08.06.2011 в 10:02. Причина: оформление
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
daxline: Performance – find() vs. exist() method Blog bot DAX Blogs 0 28.01.2011 23:14
daxline: Enhanced SysTableBrowser - View only the fields you want in table browser Blog bot DAX Blogs 0 28.01.2011 23:14
exist method on temporary table ist DAX: Программирование 3 31.03.2010 10:16
PatrickChua: Temporary table Blog bot DAX Blogs 0 04.05.2009 14:05
method insert() when insert table from outside susenyudha DAX in English 1 29.08.2008 18:51

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

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

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