diff --git a/src/bsl_helper.js b/src/bsl_helper.js index c41f1cf..9c91517 100644 --- a/src/bsl_helper.js +++ b/src/bsl_helper.js @@ -1156,19 +1156,37 @@ class bslHelper { if (value[this.nameField].toLowerCase() == metadataName) { - for (const [ikey, ivalue] of Object.entries(value.items)) { + if (Object.keys(value.items).length) { - if (ikey.toLowerCase() == metadataItem) { + for (const [ikey, ivalue] of Object.entries(value.items)) { - let methodDef = this.getMetadataMethodByName(value, metadataFunc); - let methodsName = (methodDef && methodDef.hasOwnProperty('ref') && methodDef.ref.indexOf(':obj') != -1) ? 'objMethods' : 'refMethods'; + if (ikey.toLowerCase() == metadataItem) { + + if (ivalue.hasOwnProperty('properties')) { + + let methodDef = this.getMetadataMethodByName(value, metadataFunc); + let methodsName = (methodDef && methodDef.hasOwnProperty('ref') && methodDef.ref.indexOf(':obj') != -1) ? 'objMethods' : 'refMethods'; + + itemExists = true; + this.fillSuggestionsForMetadataItem(suggestions, ivalue); + this.getMetadataMethods(suggestions, value, methodsName, key, ikey); + + } + else { + + requestMetadata(metadataName.toLowerCase() + '.' + metadataItem.toLowerCase()); + + } + } - itemExists = true; - this.fillSuggestionsForMetadataItem(suggestions, ivalue); - this.getMetadataMethods(suggestions, value, methodsName, key, ikey); } } + else { + + requestMetadata(metadataName.toLowerCase()); + + } }