I want to cut out part of a column value and transfer it to another item in the same record
Answer¶
Use "Script".
Overview¶
Use "Script" if you want to transfer a value to another "Column" when the value of the "Column" changes.
Operation Procedure¶
- Create a table
- Create a new "Script" and enter the following script content. Check "Create New" and "Edit" for the output destination to update
- From the "Editor", activate ClassA and DescriptionA according to the sample code below.
- Enter any character string in the ClassA options and press the Update button.
- Create a new record using the [+Create New] button.
- Select any value in ClassA and confirm that the first character is transferred to DescriptionA.
Code Samples¶
JavaScript¶
$(document).on('change', '#' + $p.getControl('ClassA')[0].id, function(){
//Get the value of ClassA
const myClassA = $p.getControl('ClassA').val();
//When ClassA is changed, copy the first character of ClassA to DescriptionA
//Cut off the first character from the 0th character (beginning)
$p.set($p.getControl('DescriptionA'), myClassA.slice(0,1));
});