Hi Community,
I am quite new to scripting in ARIS BA and struggle with the conversion of old VBA scripts. One topic that causes frequent issues is determing the length of an object list (I guess it is called ABOSubjectList) after deleting some of the objects. E.g. the script creates a list of object occurences like this:
oobjocclist.value = omodel.ObjOccListFilter(Constants.OT_FUNC)
But then I need to delete some of the occurences from the list e.g. because they are inactive, have the wrong symbol or whatever. The converted script does it usually by the delete function defined in the convertertools.js . It looks like this with "k" being just the index of the object that is being deleted:
oobjocclist= __delete(oobjocclist, k)
This works quite well but afterwards I am not able to find out the length of the object list. Usually I am using:
oobjocclist.value.length
but after having deleted some elements it causes an error like "TypeError: Cannot read property "length" from undefined". In most cases I have found a workaround like reading the length into a variable upfront but in some cases this is not possible/ bothersome. Any ideas how to avoid this error? Would it be better to transform the object list into an array first and then work with the array (not sure I am able to do this either)?
Any suggestions or sample code is greatly appreciated.
Cheers,
Martin