FAQ: Changing the value of one column to a specific value changes the value of another column
## Answer
This can be achieved with a "「Script」".
---
## Overview
The following is a sample code that changes the value of another column when a certain column is changed to a specific value on the Pleasanter editing screen.
## Operation
1. Create a table
1. Create a new "「Script」" and enter the contents of one of the following scripts. Check "Edit" for the output destination and update.
1. From the "「Editor」", enable the NumA or ClassA, and CheckA columns according to the sample code below.
1. Create a new record by clicking the [+New] button.
1. Open the edit screen for the record created in 3, set the [Status Column] to "Complete", enter "ClassA" as "End", and press the [Update] button.
## Script
### 1. Set the value of the NumA column to "1" when the status column is changed to "Completed"
##### JavaScript
```
$p.on('change', 'Status', function() {
//When the status column is changed to "Completed", automatically enter 1 into the NumA column
if ($p.getControl('Status').val() === '900') {
$p.set($p.getControl('NumA'), 1);
}
});
```
### 2. Set the value of the NumA column to "10" when the classA column is changed to "Ended"
##### JavaScript
```
$p.on('change', 'ClassA', function() {
//When the ClassA field is changed to "Ended", automatically enter 10 into the NumA field
if ($p.getControl('ClassA').val() === 'End') {
$p.set($p.getControl('NumA'), 10);
}
});
```
### 3. Check the CheckA column when the ClassA column is changed to "End".
##### JavaScript
```
$p.on('change', 'ClassA', function() {
//Check the CheckA column when the ClassA column is changed to "End".
if ($p.getControl('ClassA').val() === 'End') {
$p.set($p.getControl('CheckA'), true);
}
});
```
### 4. Set the string "Radio button has been changed" in ClassB when the radio button (ClassA) is changed
##### JavaScript
```js
$(document).on('change', 'input[name="Results_ClassA"]', function () {
// Set the string "Radio button has been changed" in ClassB
$p.set($p.getControl('ClassB'), 'Radio button has been changed')
});
```