How to add customs code ?

Jaidee

Member
DaDaBIK version 11.9-Elba enterprise, installed on 06-28-2023
PHP Version: 7.4.33
mysql version: 8.0.31
Web server: Apache/2.4.54 (Win64) PHP/7.4.33

I want to create new calculated col, calles asset_code
I have a country col. For each country I use 2 first letters and want to add sequential nbr.
Ex so asset codewill be BE0001, BE0002, IT0001, IT0002, etc...

SQL code, is, .....
UPDATE table_name_Asset
SET country_counter_prefix = CONCAT(LEFT(country_column, 2), LPAD(@counter:=IFNULL(@counter,0)+1, 4, '0'))
ORDER BY country_column;

How do I enter that in in custom_functions/calculated_fields_functions.php ???
function dadabik_calculated_asset_code($Params) ???
{
return $params

UPDATE table_name_Asset
SET country_counter_prefix = CONCAT(LEFT(country_column, 2), LPAD(@counter:=IFNULL(@counter,0)+1, 4, '0'))
ORDER BY country_column;
}
????
 
Last edited:
Top