My-Number String, Test Check Digit
My-Number String, Test Check Digit
Determines whether a My-Number string is valid. If valid, “OK” is recorded in the log. If invalid, the processing is terminated. It is possible to control the flow with an Error Boundary Event. My-Number is a 12-digit ID issued to all citizens and residents of Japan, including foreigners.
Configs
  • A: Set MY-NUMBER String by Expression Language *#{EL}
Script (click to open)

// GraalJS Script (engine type: 2)
// 
// Notes:
// To check the combined string, set it like "#{#q_strFirst8}#{#q_strLast4}"
//
// Notes (ja):
// 結合文字列を検査する場合は "#{#q_strFirst8}#{#q_strLast4}" のように設定します

// <根拠法>
// 行政手続における特定の個人を識別するための番号の利用等に関する法律
// の規定による通知カード及び個人番号カード並びに情報提供ネットワークシステム
// による特定個人情報の提供等に関する省令(平成26年総務省令第85号)
// https://www.cao.go.jp/bangouseido/pdf/syourei_26_85_20170529.pdf


//////// START "main()" ////////////////////////////////////////////////////////////////
main();
function main(){

//// == Config Retrieving / 工程コンフィグの参照 ==
const strA    = configs.get( "conf_StrA" )    + ""; // required
const reg12num = /^\d{12}$/;
if( ! reg12num.test( strA ) ){
  throw new Error( "\n AutomatedTask ConfigError:" +
                   " Config Date {A} is not a 12 digit number string \n" );
}


//// == Data Retrieving / ワークフローデータの参照 ==
// (nothing, except Expression Language config)


//// == Calculating / 演算 ==
let numSum = 0;
for( let i = 0; i < 5; i++){
  numSum += (11 - i - 5) * parseInt( strA.charAt(i) );
}
for( let i = 5; i < 11; i++){
  numSum += (11 - i + 1) * parseInt( strA.charAt(i) );
}
let numCheckdigit = 11 - numSum % 11;
if( numCheckdigit >= 10 ){ numCheckdigit = 0; }

if( parseInt( strA.charAt(11) ) === numCheckdigit ){
  engine.log( " AutomatedTask Check Digit: OK" );
}else{
  throw new Error( "\n AutomatedTask Error:" +
                   " This My-Number string {A} is invalid. \n" );
}


//// == ワークフローデータへの代入 / Data Updating ==
// (nothing, except Log)


} //////// END "main()" ////////////////////////////////////////////////////////////////

Download

2021-07-16 (C) Questetra, Inc. (MIT License)
https://support.questetra.com/addons/my-number-string-test-check-digit-2021/
The Add-on import feature is available with Professional or Enterprise edition.

Notes

  1. To check the combined string, set it as “#{#q_strFirst8}#{#q_strLast4}”

Capture

Determines whether a My-Number string is valid. If valid, OK is logged. If invalid, the processing is abended to control with Error Boundary Event. My-Number is a 12-digit ID issued to all citizens and residents of Japan, including foreigners.

See also

%d bloggers like this: