How to combine values from multiple columns and automatically enter them into one column
Answer¶
Use "Script".
Overview¶
Use "Script" if you want to combine values of the same type set in multiple column (add them if they are numerical value) and enter that value in a specified column.
Operation¶
- Create a recorded table.
- Enable Category A, Category B, and Category C.
- Update the following script by creating a new one in "Script" and checking "Create new" and "Edit" as the output destination.
Code Samples¶
JavaScript¶
```
$(document).on('change', '#' + $p.getControl('ClassA')[0].id, '#' + $p.getControl('ClassB')[0].id, function () {
const A = $p.getControl('ClassA').val();
const B = $p.getControl('ClassB').val();
$p.set($p.getControl('ClassC'), A + B);
})
```