Normally, in a Solidworks drawing, when you delete a note that contains one or more list-numbers that has been designated as a flag note target [see footnote 1], Solidworks simultaneously deletes the corresponding entries from the flag note bank [see footnote 2].
However, I have occasionally observed that the flag note bank in my drawing contains one or more entries for flag note targets whose containing note no longer exists. This situation seems to arise when I copy and paste sheets between drawings, or when I delete sheets from a drawing. It is as if, during these whole-sheet operations, Solidworks's internal handler that receives a notification whenever a note is modified or deleted and takes care of the associated maintenance of the flag note bank -- it is as if this handler does not get called, leaving the user in a situation where the flag note bank contains entries for non-existent targets. I have discovered no obvious way to delete these orphaned entries in the flag note bank -- not even by creating a fresh blank drawing and copying sheets into it from other drawings (the orphaned flag note bank entries seem to ride along with the copied sheets).
Does a method exist, either programatically or via the UI, to purge these orphaned flag note bank entries?
Not knowing the official words, I am using the words 'flag note target' and 'flag note reference' for the two distinct types of objects that one might call a "flag note".
On the one hand, there is the list-number that appears in a note (often the note is in the lower-left corner of the sheet, often the note is attached to the whole-sheet view rather than any specific view of the 3d model), next to a paragraph of prose text, and possibly having other numbered paragraphs above or below it. I use the word "flag note target" for this list number.
On the other hand, there is the the object which SolidWorks sometimes calls a balloon or a BOMBalloon: this is a note whose full text usually consists of a single sequence of 1 or more digits with no spaces. This note is usually attached to a specific view of the 3d solid, rather than the whole-sheet view, and this note often has a leader that is attached to an edge or a surface of a 3d solid. I use the word "flag note reference" to denote this type of object.
The user can create a flag note target when composing a note, by enabling numbered-list mode, then selecting a list-number, then, in the property manager, ticking the "Add to flag note bank" checkbox.
The user can create a flag note reference by using the Balloon annotation tool to insert a balloon, and in the process ticking the "Flag Note Bank" checkbox in the property manager.
The flag note bank is, I imagine, a relational database that records one-to-many relationships, each of which involves one flag note target and (possibly many) flag note references.