Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagegroovy
titleAdvanced version
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)


Info
See also How to Add Entry to Matrix PP.