title: Changing Text on DataTable depending on Fields
body: <p>I am using jQuery DataTables. I have a table row <code>status</code> that loops <code>&lt;td&gt;#dateFormat(someprocessTable.Date_Complete, 'mm/dd/yyyy')#&lt;/td&gt;</code>, when this loops it will either have a date or be NULL. As of right now if it is NULL then it shows PROCESSING and if it has a date it shows COMPLETED with this JS line</p>
  
  <pre><code>{ 
                "data": "Date_Complete",
                "render": function(data){
                return ((data) ? "COMPLETED" : "PROCESSING");
                }
              },
  </code></pre>
  
  <p>I need to figure out how to have it say EXEMPT if instead of processing if the <code>RMKS</code> row is saying that its Exempt with no date for <code>Date_Complete</code>. If there is a date for <code>Date_Complete</code> and <code>Rmks</code> is Exempt then it should still say COMPLETED. Would this be possible to do on the JS side?</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;table id="processing1" class="table table-hover"&gt;
      &lt;thead&gt;
          &lt;th&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/th&gt;
          &lt;th&gt;&lt;b&gt;ITEM ID&lt;/b&gt;&lt;/th&gt;
          &lt;th style="display:none;"&gt;&lt;b&gt;DEALER ID&lt;/b&gt;&lt;/th&gt;
          &lt;th style="display:none;"&gt;&lt;b&gt;DATE RECEIVED&lt;/b&gt;&lt;/th&gt;
          &lt;th style="display:none;"&gt;&lt;b&gt;OP ID&lt;/b&gt;&lt;/th&gt;
          &lt;th&gt;&lt;b&gt;DUE DATE&lt;/b&gt;&lt;/th&gt;
          &lt;th&gt;&lt;b&gt;STATUS&lt;/b&gt;&lt;/th&gt;
          &lt;th style="display:none;"&gt;&lt;b&gt;LATE&lt;/b&gt;&lt;/th&gt;
          &lt;th style="display:none;"&gt;&lt;b&gt;CLOSED BY&lt;/b&gt;&lt;/th&gt;
          &lt;th style="display:none;"&gt;&lt;b&gt;RMKS&lt;/b&gt;&lt;/th&gt;
          &lt;th style="display:none;"&gt;&lt;b&gt;PROCESSING LOCATION&lt;/b&gt;&lt;/th&gt;
          &lt;th&gt;&lt;b&gt;QTY&lt;/b&gt;&lt;/th&gt;
  
      &lt;/thead&gt;
      &lt;tbody&gt;
     &lt;cfoutput query="someprocessTable"&gt;                     
      &lt;tr&gt;
          &lt;td class="details-control"&gt;&lt;/td&gt;
          &lt;td class="LAlign"&gt;#id#&lt;/td&gt;
          &lt;td style="display:none;"&gt;#someprocessTable.name#&lt;/td&gt;
          &lt;td style="display:none;"&gt;#dateFormat(someprocessTable.Date_Received, 'mm/dd/yyyy')#&lt;/td&gt;
          &lt;td style="display:none;"&gt;#getop_id(op_id)#&lt;/td&gt;
          &lt;td&gt;#dateFormat(someprocessTable.Date_Due, 'mm/dd/yyyy')#&lt;/td&gt;
          &lt;td&gt;#dateFormat(someprocessTable.Date_Complete, 'mm/dd/yyyy')#&lt;/td&gt;
          &lt;td style="display:none;"&gt;#Completed_Late#&lt;/td&gt;
          &lt;cfif len(Closed_by)&gt;
          &lt;td style="display:none;"&gt;#getClosed_by(Closed_by)#&lt;/td&gt;
          &lt;cfelse&gt;
          &lt;td style="display:none;"&gt;#Closed_by#&lt;/td&gt;
          &lt;/cfif&gt;
          &lt;td style="display:none;"&gt;#Rmks#&lt;/td&gt;
          &lt;td style="display:none;"&gt;#Processing_Location#&lt;/td&gt;
          &lt;td class="CAlign"&gt;#Item_Count#&lt;/td&gt;
      &lt;/tr&gt;                      
     &lt;/cfoutput&gt;
     &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p><strong>JS</strong></p>
  
  <pre><code>function format ( d ) {
  
      return '&lt;div class="slider"&gt;'+
             'Item ID: '+d.id+'&lt;br&gt;'+
             'Dealer: '+d.dealerID+'&lt;br&gt;'+
             'Date Received: '+d.Date_Received+'&lt;br&gt;'+
             'Checked In: '+d.op_id+'&lt;br&gt;'+
             'Date Due: '+d.Date_Due+'&lt;br&gt;'+
             'Date Complete: '+ ((d.Date_Complete) ? d.Date_Complete : 'N/A')+'&lt;br&gt;'+
             'Completed Late: '+ ((d.Completed_Late) ? d.Completed_Late : 'N/A')+'&lt;br&gt;'+
             'Completed By: '+ ((d.Closed_by) ? d.Closed_by : 'N/A')+'&lt;br&gt;'+
             'Remarks: '+ ((d.Rmks) ? d.Rmks : 'N/A')+'&lt;br&gt;'+
             'Location: '+d.Processing_Location+'&lt;br&gt;'+
             'Item Count: '+d.Item_Count+'&lt;br&gt;'+
             '&lt;/div&gt;';
      }
  // Setup the page once it has loaded.
  
  $(document).ready(function() {
  var oTable = $('#processing1').DataTable( {
  
          "columns": [ 
              {
                  "class":          "details-control",
                  "orderable":      false,
                  "data":           null,
                  "defaultContent": ""
              },
              { "data": "id" },
              { "data": "dealerID" },
              { "data": "Date_Received" },
              { "data": "op_id" },
              { "data": "Date_Due" },
              { 
                "data": "Date_Complete",
                "render": function(data){
                return ((data) ? "COMPLETED" : "PROCESSING");
                }
              },
              { "data": "Completed_Late" },
              { "data": "Closed_by" },
              { "data": "Rmks" },
              { "data": "Processing_Location" },
              { "data": "Item_Count" }
          ],
          "order": [[1, 'asc']],
          "columnDefs": [
              { "targets": [0,2,3,4,5,6,7,8,9,10,11], "searchable": false }
          ],
          "sDom": '&lt;"row view-filter"&lt;"col-sm-12"&lt;"pull-left"l&gt;&lt;"pull-right"f&gt;&lt;"clearfix"&gt;&gt;&gt;t&lt;"row view-pager"&lt;"col-sm-12"&lt;"text-center"ip&gt;&gt;&gt;',
          select: {
              style: 'single'
          },
          scrollY:        250,
          deferRender:    true,
          scroller:       true,
          //scrollCollapse: true,
          "aLengthMenu": [[25, 50, 75, -1], [25, 50, 75, "All"]],
          "iDisplayLength": 25,
          "oLanguage": {
              "sLengthMenu": "_MENU_ &lt;label for='processing_length'&gt;&lt;strong&gt;records per page&lt;/strong&gt;&lt;/label&gt;",
              "oPaginate": {
                  "sPrevious": "«",
                  "sNext": "»",
              }
          }
  
      });
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Clgcv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Clgcv.png" alt="enter image description here"></a></p>
  
  <p>This picture show Remarks Exempt so it should show the status as EXEMPT instead of PROCESSING but once there is a date in Date_Complete it should read COMPLETED<br><a href="https://i.stack.imgur.com/ncS2e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ncS2e.png" alt="enter image description here"></a></p>
  
  <p><strong>The different possibilities:</strong> <br>
  Date for <code>Date_Complete</code> and <code>Rmks</code> Exempt = COMPLETED <BR>
  Date for <code>Date_Complete</code> and <code>Rmks</code> Null = COMPLETED <BR>
  Null Date for <code>Date_Complete</code> and <code>Rmks</code> Exempt = EXEMPT <BR>
  Null Date for <code>Date_Complete</code> and <code>Rmks</code> Null = PROCESSING</p>