Hi Martin,
Â
Hope that you are trying to retrieve values from the search result set? Have you tried this way to get the number of active tasks once the tasks are loaded?
var rows = getSearchResultDataTableRows();
alert(rows .length);
for (var rowIndex = 0; rowIndex < size(rows); ++rowIndex)
{
    var row = rowsnrowIndex];
   Â
        var status=row.datar'task.user_def2'];
        if(status=='Y')
       Â
        {
           //do something
        }
    }
}
Regards,
SAAALK
Hi,
I have used the above code and it does what I need in terms of reading the list items. Now I am trying to update them. It is a list of tasks which I want to set the status to complete in bulk. I can get the value to change on the form but not commit to the db. Here is the code I have been trying with (you can see from the comments the various attempts) Any idea how to get this working? This is being run in the TechPortal
Â
var rows = getSearchResultDataTableRows();
var noTasksToComplete=0;
if(confirm(getMessage('BULK_COMPLETE_CONFIRM','Information')))
 {
  for (var rowIndex = 0; rowIndex < size(rows); ++rowIndex)
  {
      var row = rows>rowIndex];
     Â
          var status=row.data 'task.user_def2'];
          if(status=='Y')
         Â
          {
               var taskId=row.dataÂ'task.task_id'];
               //var rowId = getDBValue(stringFormat("select metrix_row_id from task where task_id = {0}", taskId));
               //Set Status
                //var taskStatusTrans = generateDataTransaction("task", "UPDATE", stringFormat("metrix_row_id = {0}", rowId));
               //taskStatusTrans = addToDataTransaction(taskStatusTrans, "metrix_row_id", rowId);
               //taskStatusTrans = addToDataTransaction(taskStatusTrans, "task_id", taskId);
               //taskStatusTrans = addToDataTransaction(taskStatusTrans, "task_status", "COMPLETED");
               //taskStatusTrans = addToDataTransaction(taskStatusTrans, "modified_dttm", currentDate);
               //taskStatusTrans = addToDataTransaction(taskStatusTrans, "modified_by", personId);
               //saveDataTransaction(taskStatusTrans, getMessage("Task", "STATUS"));
    Â
               //setDBValue("update task set task_status='COMPLETED' where task.taskid={0}",taskId);
               //setDBValue("update task set task_status='COMPLETED' where task.taskid="+taskId);
          Â
               setValueOnListDataRow(row,'task','task_status','COMPLETED');
          Â
            noTasksToComplete=noTasksToComplete+1;
          }
     Â
  }
  Â
  saveChanges();
  alert("Tasks bulk completed: "+noTasksToComplete);
 Â
 }