Skip to main content
Solved

Client Script for Web Client - Update column

  • 15 April 2024
  • 1 reply
  • 60 views

Forum|alt.badge.img+5

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?

Best answer by Shneor Cheshin

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!

View original
Did this topic help you find an answer to your question?

Shneor Cheshin
Superhero (Employee)
Forum|alt.badge.img+27

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings