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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 15.05.2016, 18:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
vanvugt: How-to: Sort Columns - SETASCENDING
Источник: http://dynamicsuser.net/nav/b/vanvug...y-setascending
==============

Since NAV 2013 we are more and more getting the full potential out SQL Server.

In NAV 2009 (and before) it was, for example, unimaginable to setup "your own" sorting for your data retrieval as SETCURRENTKEY only allowed you to use the keys defined on the table you were going to query. Or not possible for users to sort their lists by any column, like they had been used to in, for example, Excel long time.

So now we get, more and more, the power of SQL directly accessible.

Now with NAV 2016 another step is made with SETASCENDING even though it only seems to be applicable on data processed by code (didn't get it working on data displayed in a page, temporary or not).

The next code example shows what that we can sort on individual columns (in this case Currency Code and Name).

OnRun()
ShowSetAscending(
TRUE);
ShowSetAscending(
FALSE)

LOCAL ShowSetAscending(IsAscending: Boolean)
MESSAGE(
'Ascending = %1',FORMAT(IsAscending));
WITH
Customer DOBEGIN
SETCURRENTKEY("Currency Code",Name,Contact);
SETFILTER("Currency Code"
,'SEK|USD|ZAR');
SETASCENDING("Currency Code"
,IsAscending);
SETASCENDING(Name
,NOT IsAscending);
IF FINDSET THEN
REPEAT
MESSAGE(
'Customer %1\ %2\ %3',
"No."
,
Name
,
"Currency Code");
UNTIL NEXT =0;
END





Note

The field SETASCENDING is applied to, should be part of the sorting as defined by the current active SETCURRENTKEY. If not a runtime error will be thrown:

Cannot call SetAscending on field because it is not part of the current sorting.




Источник: http://dynamicsuser.net/nav/b/vanvug...y-setascending
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Van Vugt: How-to: Sort Columns - SETASCENDING Blog bot Dynamics CRM: Blogs 0 05.03.2016 13:33
Van Vugt: How-to: Sort Columns - SETASCENDING Blog bot Dynamics CRM: Blogs 0 05.03.2016 13:33
atinkerersnotebook: Walkthrough & Tutorial Summary Blog bot DAX Blogs 1 09.09.2013 09:11
Nav developer: How to set dynamically the Key and Sort Order for the pages using NAV 2009 Web Services feature. Blog bot Dynamics CRM: Blogs 0 08.07.2009 07:04

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

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

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