imports/vx/both/code/vxapp.js
/**
     * Lookup the code matching a supplied value.
     *
     * @param {object} definition Import schema definition.
     * @param {string} value Value to use to lookup code.
     * @param {array} codeArray Standard code array bearing codes and localizations.
     * @param {number} index Index of row containing value.
     * @param {array} messages Array of messages.
     * @param {string} fieldIdKey i18n bundle key of field-identifier message.
     * @param {object} fieldIdVariables Variables to insert into field-identifier message.
     */
Lookup the code matching a supplied value.
@param {object} definition Import schema definition.
@param {string} value Value to use to lookup code.
@param {array} codeArray Standard code array bearing codes and localizations.
@param {number} index Index of row containing value.
@param {array} messages Array of messages.
@param {string} fieldIdKey i18n bundle key of field-identifier message.
@param {object} fieldIdVariables Variables to insert into field-identifier message.
Lookup the code matching a supplied value . @param { object } definition Import schema definition . @param { string } value Value to use to lookup code . @param { array } codeArray Standard code array bearing codes and localizations . @param { number } index Index of row containing value . @param { array } messages Array of messages . @param { string } fieldIdKey i18n bundle key of field - identifier message . @param { object } fieldIdVariables Variables to insert into field - identifier message .
lookupCode(definition, value, codeArray, index, messages, fieldIdKey, fieldIdVariables) {
        for (const codeElement of codeArray) {
            if (codeElement.code.toUpperCase() === value.toUpperCase()) {
                return codeElement.code
            }
            if (codeElement.localized.toUpperCase() === value.toUpperCase()) {
                return codeElement.code
            }
            if (definition.partial) {
                if (codeElement.code.toUpperCase().includes(value.toUpperCase())) {
                    return codeElement.code
                }
                if (codeElement.localized.toUpperCase().includes(value.toUpperCase())) {
                    return codeElement.code
                }
            }
        }
        const result = { success : false, icon : "TRIANGLE", key : "common.invalid_code_value" }
        VXApp.validateCreateMessage(result, index, messages, fieldIdKey, fieldIdVariables, value)
        return null
    }
lookupCode ( definition , value , codeArray , index , messages , fieldIdKey , fieldIdVariables ) { for ( const codeElement of codeArray ) { if ( codeElement . code . toUpperCase ( ) === value . toUpperCase ( ) ) { return codeElement . code } if ( codeElement . localized . toUpperCase ( ) === value . toUpperCase ( ) ) { return codeElement . code } if ( definition . partial ) { if ( codeElement . code . toUpperCase ( ) . includes ( value . toUpperCase ( ) ) ) { return codeElement . code } if ( codeElement . localized . toUpperCase ( ) . includes ( value . toUpperCase ( ) ) ) { return codeElement . code } } } const result = { success : false , icon : "TRIANGLE" , key : "common.invalid_code_value" } VXApp . validateCreateMessage ( result , index , messages , fieldIdKey , fieldIdVariables , value ) return null }
Lookup the code matching a supplied value.
Lookup the code matching a supplied value .