How to dynamically sorting in form datasource in ax 2012

Description:-
 
Here i have given simple demonstration for how to sort dynamically in form datasource in ax 2012.
I did some more research and finally found how to set the sort.
In your executeQuery method add the below code and change your table and field name.
TableName_ds.query().dataSourceNo(1).addSortField(fieldNum(TableName,FieldName),SortOrder::Ascending);

Related Posts

Thanks for comments.....

:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
:-?
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
$-)
(y)
(f)
x-)
(k)
(h)
cheer