22 lines
857 B
JavaScript

// (self.length != 0) ?
// self :
// (getContextData('2', 'cds.PRODUCT', '') == '-') ?
// self :
// getContextData('2', 'cds.PRODUCT', '')
getValue(self, self.length, getContextData('2', 'cds.PRODUCT', ''), $('dcp.HGCV3/pcl/Pattern', ''), $('dcp.HGCV3/pcl/Lot', ''));
function getValue(value, length, product, pattern, lot) {
if (pattern === 'ONEPT.PAT' && lot.toUpperCase().indexOf('LOW') > -1)
return 'Low';
else if (pattern === 'ONEPT.PAT' && lot.toUpperCase().indexOf('MID') > -1)
return 'Mid';
else if (pattern === 'ONEPT.PAT' && lot.toUpperCase().indexOf('HIGH') > -1)
return 'High';
else if (pattern === 'ONEPT.PAT' && lot.toUpperCase().indexOf('THIN') > -1)
return 'Thin';
else if (length !== 0 || product === '-')
return value;
else
return product;
}