=========
rec_count
=========

.. js:attribute:: rec_count

**domain**: client 

**language**: javascript

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

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

Read the ``rec_count`` property to get the number of records ownered by 
the item's dataset. 

If the module declares an 
:doc:`on_filter_record <on_filter_record>`
event handler and the 
:doc:`Filtered <at_filtered>` 
attribute is set, this property calculates the 
number of records that satisfy this filter, otherwise the 
:doc:`record_count <m_record_count>`
method is used to calculate the number of records.

See also
========

:doc:`record_count <m_record_count>`

Example
=======

.. code-block:: js

  function edit_invoice(invoice_id) {
      var invoices = task.invoices.copy();
      invoices.open({ where: {id: invoice_id} }, function() {
          if (invoices.rec_count) {
              invoices.edit_record();
          }
          else {
              invoices.alert_error('Invoices: record not found.');
          }
      });
  }
