def getLookupTableValueTypeCode(Object table) {
switch(table.valueType.toLowerCase()) {
case "string" :
case "int" :
case "real" :
case "date" :
return "LTV"
case "matrix6" :
return "MLTV6"
case "matrix5" :
return "MLTV5"
case "matrix4" :
return "MLTV4"
case "matrix3" :
return "MLTV3"
case "matrix2" :
return "MLTV2"
case "matrix" :
return "MLTV"
default :
return null; // must not happen
}
}
def table = api.findLookupTable("VAT")
def typeCode = getLookupTableValueTypeCode(table)
def values = [ lookupTableId: table.id, name:"alcohol", value: 130 ]
api.addOrUpdate(typeCode, values) |