title: Make a counter with conditional in Datatables
body: <p>Hello I have a question about how to make a counter since I am using datatables, currently I have data that show me the purchase order in a column and if it does not have one then I make a conditional with laravel and blade template to show me a dash &quot;-&quot; or subtraction sign, now I want to be able to make me only count the data that have an order.</p>
  <pre><code>var contador =  table.rows().count();
    $(&quot;#counta&quot;).text((+contador));
  </code></pre>
  <p>I leave an image of my table of the section of purchase orders.</p>
  <p><a href="https://i.stack.imgur.com/zF9j8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zF9j8.png" alt="enter image description here" /></a></p>
  <p>How could I adapt that function so that it does not make the count if it has a dash or the subtraction sign &quot;-&quot; that is shown when it does not have a command.</p>
  <p>This is my Datatables code</p>
  <pre><code>$(document).ready(function(){
    var table = $('#servicios').DataTable({
      processing: true,
      serverSider: true,
      ordering: true,
      &quot;pageLength&quot;: 50,
      &quot;lengthMenu&quot;: [[5,10,50,-1], [5,10,50,&quot;All&quot;]],
      &quot;order&quot;: [[ 1, &quot;asc&quot; ]],
      &quot;autoWidth&quot;: false,
      &quot;language&quot;:{
        &quot;url&quot;: &quot;//cdn.datatables.net/plug-ins/1.10.21/i18n/Spanish.json&quot;
      }
    });
   
  
    var contador =  table.rows().count();
    $(&quot;#counta&quot;).text((+contador));
  
    //Counter of the column of purchase orders 
  
    var contador_oc =  table.column(24).rows().count();
    $(&quot;#counta_oc&quot;).text((+contador));
    }); 
  </code></pre>
  <p>I would be very grateful if you help me to solve it.</p>