imports/vx/server/daemon/recordimporter.js
/**
     * Post-process the results eliminating incomplete array elements.
     *
     * @param {object} importSchema Import schema root.
     * @param {object} record Record to be post-processed.
     */
Post-process the results eliminating incomplete array elements.
@param {object} importSchema Import schema root.
@param {object} record Record to be post-processed.
Post - process the results eliminating incomplete array elements . @param { object } importSchema Import schema root . @param { object } record Record to be post - processed .
postProcess(importSchema, record) {
        Object.keys(importSchema).forEach(schemaKey => {
            const dataNode = get(record, schemaKey)
            if (_.isArray(dataNode)) {
                for (let dataNodeIndex = dataNode.length - 1; dataNodeIndex >= 0; dataNodeIndex--) {
                    if (!dataNode[dataNodeIndex]) {
                        dataNode.splice(dataNodeIndex, 1)
                        continue
                    }
                    const schemaNodeParent = get(importSchema, schemaKey)
                    for (let propertyKey of Object.keys(schemaNodeParent)) {
                        const schemaNode = schemaNodeParent[propertyKey]
                        if (schemaNode.requiredInOccurrence) {
                            const value = dataNode[dataNodeIndex][propertyKey]
                            if (!value) {
                                dataNode.splice(dataNodeIndex, 1)
                                break
                            }
                        }
                    }
                }
            }
        })
    }
postProcess ( importSchema , record ) { Object . keys ( importSchema ) . forEach ( schemaKey => { const dataNode = get ( record , schemaKey ) if ( _ . isArray ( dataNode ) ) { for ( let dataNodeIndex = dataNode . length - 1 ; dataNodeIndex >= 0 ; dataNodeIndex -- ) { if ( ! dataNode [ dataNodeIndex ] ) { dataNode . splice ( dataNodeIndex , 1 ) continue } const schemaNodeParent = get ( importSchema , schemaKey ) for ( let propertyKey of Object . keys ( schemaNodeParent ) ) { const schemaNode = schemaNodeParent [ propertyKey ] if ( schemaNode . requiredInOccurrence ) { const value = dataNode [ dataNodeIndex ] [ propertyKey ] if ( ! value ) { dataNode . splice ( dataNodeIndex , 1 ) break } } } } } } ) }
Post-process the results eliminating incomplete array elements.
Post - process the results eliminating incomplete array elements .
// Null array elements are not allowed, just remove them. This can occur if the // on input has gaps in the array indices: // For each array element, ensure that any fields that are required in the occurrence // are present. There is no guarantee that the spreadsheet contains enough information // to resolve foreign key references, such references cannot null: