============
set_order_by
============

.. js:function:: set_order_by(field_list)

**domain**: client 

**language**: javascript

**class** :doc:`Item class </refs/client/item_api>`

Description
===========

Use the ``set_order_by`` method to define and store internally the ``order_by``
option that will be used by the 
:doc:`open <m_open>` 
method, when its own ``order_by`` option is not specified. The 
:doc:`open <m_open>` 
method clears internally stored parameter value. 

The ``field_list`` parameter is a list of field names. If there is a sign '-' 
before a field name, then on this field records will be sorted in decreasing 
order.


Example
=======

The result of the execution of following code snippets wil be the same:

.. code-block:: js

    item.open({order_by: ['-invoicedate']});

.. code-block:: js

    item.set_order_by(['-invoicedate']);
    item.open();
    
See also
========

:doc:`Dataset </programming/data/dataset>`

:doc:`open <m_open>`