//Script for UPDM 2019 Data Models
//Script to decode and populate the MATERIAL value from the BARCODE value

if ($feature.BARCODE == null)  // Preserve original MATERIAL value if BARCODE is null
   return $feature.MATERIAL;

return mid($feature.BARCODE,9,1);