Interface ModelLookupTablesContextReadWrite

All Superinterfaces:
ModelLookupTablesContextReadOnly

public interface ModelLookupTablesContextReadWrite extends ModelLookupTablesContextReadOnly
  • Method Details

    • addLookupTable

      Add a LookupTable owned by the model. If the table already exists, it is replaced by this new table.

      The LookupTable.LookupTableValueType must be one of [MATRIX, MATRIX2, MATRIX3, MATRIX4, MATRIX5, MATRIX6, JSON, JSON2].

      The definition of columnsSpecs is associating LookupTableValue fields name with their attribute metadata. Beware of the field names (keys and attributes) may change depending on the LookupTable.LookupTableValueType. A metadata may not be given for each field, in that case those fields are still present but will be presented to the user in a raw style.

      Sample code:

      
           model.addLookupTable(
                   "CustomerDiscounts",
                   "Discount By Customer",
                   LookupTableValueType.MATRIX2,
                   [
                       key1: [label:"Customer ID", fieldFormatType: FieldFormatType.TEXT],
                       key2: [label:"Customer Group", fieldFormatType: FieldFormatType.TEXT],
                       attribute1: [label:"Discount Name", fieldFormatType: FieldFormatType.TEXT],
                       attribute2: [label:"Discount Rate", fieldFormatType: FieldFormatType.NUMERIC]
                   ]
           )
       
      Sample Json code:
      
           model.lookupTablesContext().addLookupTable(
               "MyJsonLookupTable",
               "My Json Lookup Table",
               LookupTable.LookupTableValueType.JSON,
               [
                       name        : [label: "Name", formatType: FieldFormatType.TEXT],
                       myValue     : [label: 'Values', formatType: FieldFormatType.TEXT],
                       anotherField: [label: 'Yes or No', formatType: FieldFormatType.TEXT]
               ]
           )
       
      Sample Json2 code:
      
           model.lookupTablesContext().addLookupTable(
               "MyJson2LookupTable",
               "My Json2 Lookup Table",
               LookupTable.LookupTableValueType.JSON2,
               [
                       key1        : [label: "Name", formatType: FieldFormatType.TEXT],
                       key2        : [label: "Country", formatType: FieldFormatType.TEXT],
                       myValue     : [label: 'Values', formatType: FieldFormatType.TEXT],
                       anotherField: [label: 'Yes or No', formatType: FieldFormatType.TEXT]
               ]
           )
       
      Parameters:
      name - The name of the LookupTable, must be unique per model
      label - The label of the LookupTable
      valueType - The LookupTable.LookupTableValueType of the LookupTable
      columnsSpecs - Definition of the LookupTable value metadata to be created
      Returns:
      The added ModelLookupTablesContextReadOnly.ModelLookupTable
      Since:
      9.0 Hurricane
    • lookupTable

      Specified by:
      lookupTable in interface ModelLookupTablesContextReadOnly
      Parameters:
      name - The name of the LookupTable, must be unique per model
      Returns:
      The ModelLookupTablesContextReadWrite.MutableModelLookupTable owned by this model or null if it doesn't exist
      Since:
      9.0 Hurricane