Solved

Client Script for Web Client - Update column

  • 15 April 2024
  • 1 reply
  • 36 views

Userlevel 1
Badge +5
  • Sidekick (Customer)
  • 10 replies

I am having issues trying to understand how to update values using client scripts. My plan is to update non_part_usage.user_def4 to blank if the personID is null or empty.

My understanding is that setControlValue is used to update, but I am not sure how to link the value from the array (npu_id) and setControlValue.

Client Script

var personID = getControlValue('task','person_id');
alert(personID);

if(isNullOrEmptyString(personID))
{
var task_id = getControlValue('task','task_id');
var npu_id = getDBValues('SP_COUNT_NPU',[task_id]);

for(var i=0;i<size(npu_id);++i)
{
setControlValue('non_part_usage', 'user_def4', '');
}
}

Client Script SQL 

SELECT npu_id FROM NON_PART_USAGE WHERE task_id =  '{0}'

A couple of questions:

  1. How do you update the user_def4 to blank?
  2. Is there a way to mass update all the values in the array?
icon

Best answer by Shneor Cheshin 15 April 2024, 12:35

View original

1 reply

Userlevel 6
Badge +26

Hi @qquac 

You are working on a related table and not directly on the task.

It would help if you worked with ‘row’ functions.

For example

 

var rows = getDataTableRows('non_part_usage');
if(size(rows) > 0)
{
    for(var i=0;i<size(rows);++i)
    {
var row = rows[i];
        setRowControlValue(row, 'non_part_usage', 'user_def4','');
    }
}

 

Cheers!

Reply