Line 57: |
Line 57: |
| // Mode 'update record' field1 field2 | | // Mode 'update record' field1 field2 |
| // retrieve record, make record.field1 = field2, push back | | // retrieve record, make record.field1 = field2, push back |
| + | |
| + | // Mode 'remove from record' field1 |
| + | // retrieve record, splice/delete record.field1, push back |
| + | |
| + | // Mode 'remove from record' field1 field2 |
| + | // retrieve record, splice/delete record.field1.field2, push back |
| | | |
| async function Enquire( pddbname, record, sqitch, control_1, control_2, control_3 ) { | | async function Enquire( pddbname, record, sqitch, control_1, control_2, control_3 ) { |
Line 137: |
Line 143: |
| store.put(inp_obj); | | store.put(inp_obj); |
| } else { | | } else { |
− | inp_obj[ control_1 ] = inp_obj[ control_1 ] || {}; | + | inp_obj[ control_1 ] = inp_obj[ control_1 ] || (isNaN( control_1 )) ? {} : []; |
| if ( Array.isArray( inp_obj[ control_1 ] ) ) { | | if ( Array.isArray( inp_obj[ control_1 ] ) ) { |
| inp_obj[ control_1 ].push( control_2 ); | | inp_obj[ control_1 ].push( control_2 ); |
Line 169: |
Line 175: |
| if ( control_1 != undefined ) { | | if ( control_1 != undefined ) { |
| if ( control_2 != undefined ) { | | if ( control_2 != undefined ) { |
− | if ( Array.isArray( inp_obj[ control_1 ] ) ) { | + | if ( Array.isArray( inp_obj[ control_1 ] ) && !isNan( control_2 ) ) { |
| inp_obj[ control_1 ].splice( control_2, 1 ); | | inp_obj[ control_1 ].splice( control_2, 1 ); |
| } else { | | } else { |