store - larger data storage for complex item types
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © kaigouthro
//@version=5
//@description Object/Property Storage System.semi Simplified.  
// Set an object up, and add as man properties as ou wish.
// a property can be one of any pine built in types. so a single 
// object can contain sa, ohlc each with a color, a float, an assigned int
// and those 4 props each have 3 sub-assigned values.
// as in demo, the alternating table object has 2 different tables
// it's a pseudo more complex wa to create our own flexible
// version of a UDT, but that will not ~break~ on library updates
// so you can update awa without fear, as this libb will no change
// saving ou the hassle of creating UDT's that continually change.
library("store")

export  type boxdict
    matrix<string>    keys
    matrix<box>       items                

export  type booldict
    matrix<string>    keys
    matrix<bool>      items                

export  type colordict
    matrix<string>    keys
    matrix<color>     items                    

export  type floatdict
    matrix<string>    keys
    matrix<float>     items                    

export  type intdict
    matrix<string>    keys
    matrix<int>       items                

export  type labeldict
    matrix<string>    keys
    matrix<label>     items                    

export  type linedict
    matrix<string>    keys
    matrix<line>      items                    

export  type linefilldict
    matrix<string>    keys
    matrix<linefill>  items                        

export  type stringdict
    matrix<string>    keys
    matrix<string>    items                    

export  type tabledict
    matrix<string>    keys
    matrix<table>     items                    

export  type dictionary
    boxdict      boxs    
    booldict     bools        
    colordict    colors        
    floatdict    floats        
    intdict      ints    
    labeldict    labels        
    linedict     lines        
    linefilldict linefills            
    stringdict   strings        
    tabledict    tables        
    matrix<string> keys

export  type item
    int    objCol      = na
    int    propRow     = na
    string object      = na
    string property    = na
    string actionItem  = ''

// @type Dictionar OF dictionaries
// for the intrepid mad scientists..
// theoretically, have as many as TV servers can handle
// dictionaries with slices (individual types)
// as many as ou want in any config ou want.
export  type dictionaries
    dictionary[] dicts


// set some constants internal
var _REMOVEOBJ = 'remove obj'
var _REMOVEPROP= 'remove prop'
var _GET       = 'get'       
var _DELETE    = 'delete'           
var _SET       = 'set'       


_createID(item _idx, matrix<string> _keys)=>
    _newIDX = item.copy(_idx)
    switch
        na(_idx.objCol) or na(_idx.propRow) =>
            _objkeys          = matrix.row      ( _keys           , 0                )
            _hasobject        = array.includes  ( _objkeys        , _newIDX.object   )
            _newIDX.objCol   := array.indexof   ( _objkeys        , _hasobject       ? _newIDX.object  : string(na)) 
            if not _hasobject
                matrix.set   ( _keys, 0        , _newIDX.objCol  , _newIDX.object    )
            _objprops         = matrix.col      ( _keys           , _newIDX.objCol   )
            _hasproperty      = array.includes  ( _objprops       , _newIDX.property )
            _newIDX.propRow  := array.indexof   ( _objprops       , _hasproperty     ? _newIDX.property : string(na)) 
            if not _hasproperty
                matrix.set(_keys, _newIDX.propRow , _newIDX.objCol , _newIDX.property )
        =>
            _newIDX.objCol    := _idx.objCol
            _newIDX.propRow   := _idx.propRow
    _newIDX

_action( _item, subdict, item _idx )=>
    // create index
    _index  = _createID(_idx,subdict.keys)
    string _object   = _idx.object
    string _property = _idx.property
    _keys   = subdict.keys 
    _vals   = subdict.items
    _naItem = matrix.get(_vals ,0 , 0 )
    _itemwas= matrix.get(_vals ,_index.propRow , _index.objCol )
    _out    = switch _idx.actionItem
        _GET     => matrix.get(_vals ,_index.propRow , _index.objCol )
        _SET     => matrix.set(_vals ,_index.propRow , _index.objCol , _item   ),  _item
        _DELETE  => matrix.set(_vals ,_index.propRow , _index.objCol , _naItem ), _itemwas
        => _naItem
    _index.actionItem := ''
    subdict.keys  := _keys
    subdict.items := _vals
    [_out, _index]

import kaigouthro/columns/2
_remove(dictionary _dict, item _idx)=>
    _newIDX            = item.copy(_idx)
    _objkeys           = matrix.row        ( _dict.keys          , 0               )
    _hasobject         = array.includes    ( _objkeys            , _newIDX.object  )
    if _hasobject
        _newIDX.objCol:= array.indexof   ( _objkeys            , _newIDX.object   ) 
        _objprops      = matrix.col      ( _dict.keys          , _newIDX.objCol   )
        _hasproperty = array.includes  ( matrix.col ( _dict.keys , _newIDX.objCol ) , _newIDX.property )
        if _hasproperty
            _newIDX.propRow := array.indexof  ( _objprops      , _newIDX.property )  
        switch _idx.actionItem
            _REMOVEOBJ  =>                 
                int _rows   = matrix.rows(_dict.bools.keys)
                columns.set(_dict.bools.keys      , _newIDX.objCol, array.new_string  (_rows))
                columns.set(_dict.boxs.items      , _newIDX.objCol, array.new_box     (_rows))
                columns.set(_dict.bools.items     , _newIDX.objCol, array.new_bool    (_rows))
                columns.set(_dict.colors.items    , _newIDX.objCol, array.new_color   (_rows))
                columns.set(_dict.floats.items    , _newIDX.objCol, array.new_float   (_rows))
                columns.set(_dict.ints.items      , _newIDX.objCol, array.new_int     (_rows))
                columns.set(_dict.labels.items    , _newIDX.objCol, array.new_label   (_rows))
                columns.set(_dict.lines.items     , _newIDX.objCol, array.new_line    (_rows))
                columns.set(_dict.linefills.items , _newIDX.objCol, array.new_linefill(_rows))
                columns.set(_dict.strings.items   , _newIDX.objCol, array.new_string  (_rows))
                columns.set(_dict.tables.items    , _newIDX.objCol, array.new_table   (_rows))
            _REMOVEPROP => 
                if _hasproperty
                    matrix.set (_dict.bools.keys      , _newIDX.propRow, _newIDX.objCol, string  (na))
                    matrix.set (_dict.boxs.items      , _newIDX.propRow, _newIDX.objCol, box     (na))
                    matrix.set (_dict.bools.items     , _newIDX.propRow, _newIDX.objCol, bool    (na))
                    matrix.set (_dict.colors.items    , _newIDX.propRow, _newIDX.objCol, color   (na))
                    matrix.set (_dict.floats.items    , _newIDX.propRow, _newIDX.objCol, float   (na))
                    matrix.set (_dict.ints.items      , _newIDX.propRow, _newIDX.objCol, int     (na))
                    matrix.set (_dict.labels.items    , _newIDX.propRow, _newIDX.objCol, label   (na))
                    matrix.set (_dict.lines.items     , _newIDX.propRow, _newIDX.objCol, line    (na))
                    matrix.set (_dict.linefills.items , _newIDX.propRow, _newIDX.objCol, linefill(na))
                    matrix.set (_dict.strings.items   , _newIDX.propRow, _newIDX.objCol, string  (na))
                    matrix.set (_dict.tables.items    , _newIDX.propRow, _newIDX.objCol, table   (na))
    _idx.actionItem  := ''
    _idx
        

//@function Add/Updates item to storage. Autoselects subclass dictionary on set
//@param   dict       (dictionary) dict.type subdictionary (req for overload)
//@param   _object    (string)     object name
//@param   _property  (string)     property name
//@param   _item      (<any>)       item to set
//@param   _idx       (item)       item to set
//@returns item item wwith column/row 
export method set( dictionary dict , string _object ,string  _prop, bool     _item) =>
    [_passthrough,_idx] = _action( _item, dict.bools      , item.new(na,na,_object,_prop, _SET) )
    _idx
export method set( dictionary dict , string _object ,string  _prop, box      _item) =>
    [_passthrough,_idx] = _action( _item, dict.boxs       , item.new(na,na,_object,_prop, _SET) )
    _idx
export method set( dictionary dict , string _object ,string  _prop, color    _item) =>
    [_passthrough,_idx] = _action( _item, dict.colors     , item.new(na,na,_object,_prop, _SET) )
    _idx
export method set( dictionary dict , string _object ,string  _prop, float    _item) =>
    [_passthrough,_idx] = _action( _item, dict.floats     , item.new(na,na,_object,_prop, _SET) )
    _idx
export method set( dictionary dict , string _object ,string  _prop, int      _item) =>
    [_passthrough,_idx] = _action( _item, dict.ints       , item.new(na,na,_object,_prop, _SET) )
    _idx
export method set( dictionary dict , string _object ,string  _prop, label    _item) =>
    [_passthrough,_idx] = _action( _item, dict.labels     , item.new(na,na,_object,_prop, _SET) )
    _idx
export method set( dictionary dict , string _object ,string  _prop, line     _item) =>
    [_passthrough,_idx] = _action( _item, dict.lines      , item.new(na,na,_object,_prop, _SET) )
    _idx
export method set( dictionary dict , string _object ,string  _prop, linefill _item) =>
    [_passthrough,_idx] = _action( _item, dict.linefills  , item.new(na,na,_object,_prop, _SET) )
    _idx
export method set( dictionary dict , string _object ,string  _prop, string   _item) =>
    [_passthrough,_idx] = _action( _item, dict.strings    , item.new(na,na,_object,_prop, _SET) )
    _idx
export method set( dictionary dict , string _object ,string  _prop, table    _item) =>
    [_passthrough,_idx] = _action( _item, dict.tables     , item.new(na,na,_object,_prop, _SET) )
    _idx
export method set( dictionary dict , item _index, bool     _item) =>
    _index.actionItem := _SET
    [_passthrough,_idx] = _action( _item, dict.bools      , _index) 
    _idx
export method set( dictionary dict , item _index, box      _item) =>
    _index.actionItem := _SET
    [_passthrough,_idx] = _action( _item, dict.boxs       , _index) 
    _idx
export method set( dictionary dict , item _index, color    _item) =>
    _index.actionItem := _SET
    [_passthrough,_idx] = _action( _item, dict.colors     , _index) 
    _idx
export method set( dictionary dict , item _index, float    _item) =>
    _index.actionItem := _SET
    [_passthrough,_idx] = _action( _item, dict.floats     , _index) 
    _idx
export method set( dictionary dict , item _index, int      _item) =>
    _index.actionItem := _SET
    [_passthrough,_idx] = _action( _item, dict.ints       , _index) 
    _idx
export method set( dictionary dict , item _index, label    _item) =>
    _index.actionItem := _SET
    [_passthrough,_idx] = _action( _item, dict.labels     , _index) 
    _idx
export method set( dictionary dict , item _index, line     _item) =>
    _index.actionItem := _SET
    [_passthrough,_idx] = _action( _item, dict.lines      , _index) 
    _idx
export method set( dictionary dict , item _index, linefill _item) =>
    _index.actionItem := _SET
    [_passthrough,_idx] = _action( _item, dict.linefills  , _index) 
    _idx
export method set( dictionary dict , item _index, string   _item) =>
    _index.actionItem := _SET
    [_passthrough,_idx] = _action( _item, dict.strings    , _index) 
    _idx
export method set( dictionary dict , item _index, table    _item) =>
    _index.actionItem := _SET
    [_passthrough,_idx] = _action( _item, dict.tables     , _index) 
    _idx

//@function Get item by object name and property (string)
//@param   typedict   (<any>dict) dict.type subdictionary (req for overload)
//@param   _object    (string)    object name
//@param   _property  (string)    property name
//@param   _index     (string)    item object with coords
//@returns <type> item from storage
export method get(boxdict      typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  box(na)      , typedict  , item.new(na,na,_object,_prop, _GET))
    _item
export method get(booldict     typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  bool(na)     , typedict  , item.new(na,na,_object,_prop, _GET))
    _item
export method get(colordict    typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  color(na)    , typedict  , item.new(na,na,_object,_prop, _GET))
    _item
export method get(floatdict    typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  float(na)    , typedict  , item.new(na,na,_object,_prop, _GET))
    _item
export method get(intdict      typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  int(na)      , typedict  , item.new(na,na,_object,_prop, _GET))
    _item
export method get(labeldict    typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  label(na)    , typedict  , item.new(na,na,_object,_prop, _GET))
    _item
export method get(linedict     typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  line(na)     , typedict  , item.new(na,na,_object,_prop, _GET))
    _item
export method get(linefilldict typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  linefill(na) , typedict  , item.new(na,na,_object,_prop, _GET))
    _item
export method get(stringdict   typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  string(na)   , typedict  , item.new(na,na,_object,_prop, _GET))
    _item
export method get(tabledict    typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  table(na)    , typedict  , item.new(na,na,_object,_prop, _GET))
    _item
export method get(boxdict      typedict, item _index)=>
    _index.actionItem := _GET
    [_item,_idx] = _action(  box(na)      , typedict  , _index)
    _item
export method get(booldict     typedict, item _index)=>
    _index.actionItem := _GET
    [_item,_idx] = _action(  bool(na)     , typedict  , _index)
    _item
export method get(colordict    typedict, item _index)=>
    _index.actionItem := _GET
    [_item,_idx] = _action(  color(na)    , typedict  , _index)
    _item
export method get(floatdict    typedict, item _index)=>
    _index.actionItem := _GET
    [_item,_idx] = _action(  float(na)    , typedict  , _index)
    _item
export method get(intdict      typedict, item _index)=>
    _index.actionItem := _GET
    [_item,_idx] = _action(  int(na)      , typedict  , _index)
    _item
export method get(labeldict    typedict, item _index)=>
    _index.actionItem := _GET
    [_item,_idx] = _action(  label(na)    , typedict  , _index)
    _item
export method get(linedict     typedict, item _index)=>
    _index.actionItem := _GET
    [_item,_idx] = _action(  line(na)     , typedict  , _index)
    _item
export method get(linefilldict typedict, item _index)=>
    _index.actionItem := _GET
    [_item,_idx] = _action(  linefill(na) , typedict  , _index)
    _item
export method get(stringdict   typedict, item _index)=>
    _index.actionItem := _GET
    [_item,_idx] = _action(  string(na)   , typedict  , _index)
    _item
export method get(tabledict    typedict, item _index)=>
    _index.actionItem := _GET
    [_item,_idx] = _action(  table(na)    , typedict  , _index)
    _item

//@function Remove a specific property from an object
//@param   typedict   (<any>dict) dict.type subdictionary (req for overload)
//@param   _object    (string)    object name
//@param   _property  (string)    property name
//@param   _index     (string)    item object with coords
//@returns <type> item from storage
export method remove(boxdict      typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  box(na)      , typedict  , item.new(na,na,_object,_prop, _DELETE))
    _item
export method remove(booldict     typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  bool(na)     , typedict  , item.new(na,na,_object,_prop, _DELETE))
    _item
export method remove(colordict    typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  color(na)    , typedict  , item.new(na,na,_object,_prop, _DELETE))
    _item
export method remove(floatdict    typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  float(na)    , typedict  , item.new(na,na,_object,_prop, _DELETE))
    _item
export method remove(intdict      typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  int(na)      , typedict  , item.new(na,na,_object,_prop, _DELETE))
    _item
export method remove(labeldict    typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  label(na)    , typedict  , item.new(na,na,_object,_prop, _DELETE))
    _item
export method remove(linedict     typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  line(na)     , typedict  , item.new(na,na,_object,_prop, _DELETE))
    _item
export method remove(linefilldict typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  linefill(na) , typedict  , item.new(na,na,_object,_prop, _DELETE))
    _item
export method remove(stringdict   typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  string(na)   , typedict  , item.new(na,na,_object,_prop, _DELETE))
    _item
export method remove(tabledict    typedict, string _object , string _prop)=>
    [_item,_idx] = _action(  table(na)    , typedict  , item.new(na,na,_object,_prop, _DELETE))
    _item
export method remove(boxdict      typedict, item _index)=>
    _index.actionItem := _DELETE
    [_item,_idx] = _action(  box(na)      , typedict  , _index)
    _item
export method remove(booldict     typedict, item _index)=>
    _index.actionItem := _DELETE
    [_item,_idx] = _action(  bool(na)     , typedict  , _index)
    _item
export method remove(colordict    typedict, item _index)=>
    _index.actionItem := _DELETE
    [_item,_idx] = _action(  color(na)    , typedict  , _index)
    _item
export method remove(floatdict    typedict, item _index)=>
    _index.actionItem := _DELETE
    [_item,_idx] = _action(  float(na)    , typedict  , _index)
    _item
export method remove(intdict      typedict, item _index)=>
    _index.actionItem := _DELETE
    [_item,_idx] = _action(  int(na)      , typedict  , _index)
    _item
export method remove(labeldict    typedict, item _index)=>
    _index.actionItem := _DELETE
    [_item,_idx] = _action(  label(na)    , typedict  , _index)
    _item
export method remove(linedict     typedict, item _index)=>
    _index.actionItem := _DELETE
    [_item,_idx] = _action(  line(na)     , typedict  , _index)
    _item
export method remove(linefilldict typedict, item _index)=>
    _index.actionItem := _DELETE
    [_item,_idx] = _action(  linefill(na) , typedict  , _index)
    _item
export method remove(stringdict   typedict, item _index)=>
    _index.actionItem := _DELETE
    [_item,_idx] = _action(  string(na)   , typedict  , _index)
    _item
export method remove(tabledict    typedict, item _index)=>
    _index.actionItem := _DELETE
    [_item,_idx] = _action(  table(na)    , typedict  , _index)
    _item

//@function Remove a complete Object and all props
//@param   typedict   (<any>dict) dict.type subdictionary (req for overload)
//@param   _object    (string)    object name
//@param   _property  (string)    property name
//@param   _index     (string)    item object with coords
//@returns <type> item from storage
export method delete(dictionary   _dict, string _object )=>
    _remove(_dict,item.new(na,na,_object,_object,_REMOVEOBJ))
export method delete(dictionary   _dict, item _index)=>
    _index.actionItem := _REMOVEOBJ
    _remove(_dict, _index)

//@function Remove Property slot for all 10 item types
//@param   _dict      (dictionary) The full dictionary item
//@param   _object    (string)    object name
//@param   _property  (string)    property name
//@param   _index     (string)    item object with coords
//@returns <type> item from storage
export method wipe(dictionary   _dict, string _object , string _prop)=>
    _remove(_dict,item.new(na,na,_object,_prop,_REMOVEPROP))
export method wipe(dictionary   _dict, item _index)=>
    _index.actionItem := _REMOVEPROP
    _remove(_dict, _index)



//@function Create New Dictionary ready to use (9999 size limit - (_objlim +_Proplim) for row/column 0)
// # Full dictionary with all types
// > start with this          
//@param _Objlim    (int) maximum objects (think horizontal)
//@param _Proplim   (int) maximum properties per obj (vertical)
//@returns dictionary typoe object
export method init(int _Objlim, int _Proplim)=>
    varip _keystorage        = matrix.new<string>   (_Proplim,_Objlim, string    (na))
    var   dict  = dictionary.new()
    if barstate.isfirst
        matrix.set(_keystorage,0,0,'---NO_OBJECT_HERE---')
        dict.keys := _keystorage
        var     _boxstorage      = matrix.new<box>      (_Proplim,_Objlim, box       (na)) 
        varip   _boolstorage     = matrix.new<bool>     (_Proplim,_Objlim, bool      (na)) 
        var     _colorstorage    = matrix.new<color>    (_Proplim,_Objlim, color     (na)) 
        varip   _floatstorage    = matrix.new<float>    (_Proplim,_Objlim, float     (na)) 
        varip   _intstorage      = matrix.new<int>      (_Proplim,_Objlim, int       (na)) 
        var     _labelstorage    = matrix.new<label>    (_Proplim,_Objlim, label     (na)) 
        var     _linestorage     = matrix.new<line>     (_Proplim,_Objlim, line      (na)) 
        var     _linefillstorage = matrix.new<linefill> (_Proplim,_Objlim, linefill  (na)) 
        varip   _stringstorage   = matrix.new<string>   (_Proplim,_Objlim, string    (na)) 
        var     _tablestorage    = matrix.new<table>    (_Proplim,_Objlim, table     (na)) 
        dict.boxs               := boxdict.new          (_keystorage , _boxstorage       )
        dict.bools              := booldict.new         (_keystorage , _boolstorage      )
        dict.colors             := colordict.new        (_keystorage , _colorstorage     )
        dict.floats             := floatdict.new        (_keystorage , _floatstorage     )
        dict.ints               := intdict.new          (_keystorage , _intstorage       )
        dict.labels             := labeldict.new        (_keystorage , _labelstorage     )
        dict.lines              := linedict.new         (_keystorage , _linestorage      )
        dict.linefills          := linefilldict.new     (_keystorage , _linefillstorage  )
        dict.strings            := stringdict.new       (_keystorage , _stringstorage    )
        dict.tables             := tabledict.new        (_keystorage , _tablestorage     )
        // dict :=dictionary.new(boxsdict,boolsdict,colorsdict,floatsdict,intsdict,labelsdict,linesdict,linefillsdict,stringsdict,tablesdict,_keystorage)
    
    dict


o  = '    ////////////////////////////////////     '
o := '        _____                                '
o := '       |     \.-----.--------.-----.         '
o := '       |  --  |  -__|        |  _  |         '
o := '       |_____/|_____|__|__|__|_____|         '


_maxobjects = input.int(10,'Maximum objects',5,100)    
_maxprops   = input.int(10,'Maximum props',5,100)    

// create main dictionary
var dict = init(_maxobjects,_maxprops)

// place some values to plot and get Index objects (matrix coords)
_open_IDX    = dict.set (  "ohlc" , 'o' , open   )
_high_IDX    = dict.set (  "ohlc" , 'h' , high   )
_low_IDX     = dict.set (  "ohlc" , 'l' , low    )
_close_IDX   = dict.set (  "ohlc" , 'c' , close  )


///////////////////////////////////
// a more complex example
// table1 and table2 each have a string, color, and table asigned.
// you cannot assignmore than 1 of the same type to the same property.
// normally each prop would be one item
// one of each type per prop is bonus.

// for each (in this example) each table prop
// has a color, title, and table (cannot overlap two colors on same prop name)
// the constants only get set once, the others update each calc
if barstate.isfirst
    set ( dict,  'Alternating Table'   ,  'table1'      ,  color.rgb(134, 176, 214)                            )
    set ( dict,  'Alternating Table'   ,  'table2'      ,  color.rgb(255, 248, 119)                            )
    set ( dict,  'Alternating Table'   ,  'table1'      ,  'ONE'                                    )
    set ( dict,  'Alternating Table'   ,  'table2'      ,  'TWO'                                    )
    set ( dict,  'Alternating Table'   ,  'subtitle'    ,  '\n\n Common Content'                         )
set ( dict,  'Alternating Table'   ,  'table1'      , table.new(position.middle_center   ,1,1)  )
set ( dict,  'Alternating Table'   ,  'table2'      , table.new(position.bottom_center   ,1,1)  )
set ( dict,  'Alternating Table'   ,  'current'     ,  bar_index % 2                            )
                                   
// fetch which prop of the alt table to use                                   
_currentTable = get(dict.ints , 'Alternating Table', 'current') == 0 ? 'table1' : 'table2'

// update tablecell
table.cell(  get( dict.tables ,    // object dictionary subclass
         'Alternating Table'  ,    // object name
         _currentTable        ),    
         0,0,                      // table row and column
         // join title (alternatiung) and subtitle (common)
         get(dict.strings         , 'Alternating Table', _currentTable ) + 
         get(dict.strings         , 'Alternating Table', 'subtitle'    ) ,
         
         bgcolor = get(dict.colors,'Alternating Table' , _currentTable ))

import kaigouthro/matrixautotable/12 as m

if not array.includes(matrix.row(dict.bools.keys,0),'replace del')
    // set this for a one time, it will be deleted after read and placed to a non-updated position 
    set(dict,'del' ,'val' , close*1.002)
    set(dict,'delete only prop1','prop1', close/1.002)

if bar_index% 7==0
    // to remove just one prop
    set(dict,'delete only prop1','prop2', close/1.002)
    set(dict,'delete only prop1','prop3', close/1.002)
    set(dict,'delete only prop1','prop4', close/1.002)
    set(dict,'delete only prop1','prop5' , close*1.002)

plot(get(dict.floats,'del','val' )/2+close/2,'Delete before table',#ffffff,2)
plot(get(dict.floats,'ohlc', 'c'  ),'Dict Close'   ,#ffffff,2)

if bar_index% 3 == 0
    // if del obj exists, get, ipe, place what was to new
    if array.includes(matrix.row(dict.bools.keys,0),'del')and bar_index% 7==0
        _delval = get(dict.floats,'del','val')
        delete(dict,'del')
        set   (dict,'replace del','newwval',_delval)

wipe(dict,'delete only prop1','prop1')

// testing made visible
if barstate.islast
    m.anytwo(dict.keys, dict.floats.items)

