Skip to content

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

  1. Create a table
  2. Create a new "Script" and enter the following script content. Check "Create New" and "Edit" for the output destination to update
  3. From the "Editor", activate ClassA and DescriptionA according to the sample code below.
  4. Enter any character string in the ClassA options and press the Update button.
  5. Create a new record using the [+Create New] button.
  6. 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));    
});