Im facing problem while generating code ‘id_klaim’ on my table before insert . it keep none
i have one table tbl_a contains field : id_klaim, cust_name, awal_periode as date formatted YYYY/MM/DD, etc
but i need to insert char “KLM” as code + YY + MM + auto increment values 4 digits
but resulting keep none with my tried
here is my macro that i had seen from other Q&A post :
$tgl = {awal_periode};
$tahun = substr($tgl,2,2);
$bulan = substr($tgl,5,2);
$jenis = “KLM”;
$tahunbulan = $jenis . $tahun . $bulan ;
sc_lookup(dataset,“select max((substr(id_klaim,8,5))) from tbl_klaim where substr(id_klaim,1,6) = '” . $tahunbulan . “’”);
$proses1 = {dataset}[0][0];
$jml = $proses1 + 1 ;
$hasil = $tahunbulan . “/” . str_pad($jml,5, “0”, STR_PAD_LEFT);
{id_klaim} = $hasil;
Please ! Thanks