Personally, I would definitely recommend using variant 1 with * . It seems to me shorter, brighter and clearer.
I would not worry about the speed of evaluation * (just feeling - certainly I have no numbers or proofs about performance).
If I am correct and remember well the ISC courses, the "global directory/list of global vectors" is held somewhere in memory for each process while beeing in certain namespace. And therefore should be quickly evaluated.
Additionally, if you would need to add a new global in the future (such as qAuditS for streams), then the current definition will satisfy such need automatically and without updating the map table. However similar mapping for the different LIVE / TEST / EDU / CLONE / ... instances should always be done by scripts and automatically during the upgrade every instance.
Thanks Alexey. Sure. It depens, whether you have Latin1/Latin2 characters in subscipts or not. If not, then everything is much easier and can be done by simple $query loop.
In case you have
^GLOBAL("Latin1/Latin2 subscript 1", large subnodes)
^GLOBAL("Latin1/Latin2 subscript 2", large subnodes)
then it is not trivial to "rename" all ^GLOBAL("Latin1/Latin2 subscript 1") node under ^GLOBAL("UTF subscript 1").
1) there is no easy/cheap way to "rename" node (kill + merge + kill is not the solution)
2) even if some "rename" solution will be implented, the the $QUERY loop will be confused
- new ^GLOBAL("UTF subscript 1") may collate arbitrary wherever
I do rememeber my discussion with Andreas about that. And as Andreas claimed to me, that "RENAME" command is part of Caché product :-) and found later, that he was confused by some internal ISC discussions about this topic.
Just some hints. I wrote a few helper functions for similar purposes.
MaskToPattern(mask,sw) ; mask with * and ? -> M pattern
; $$MaskToPattern^Idea.System.ZIF("ABC?D*") -> 1"ABC"1E1"D".E
; sw .. used for contains test (.E on both ends) : $$MaskToPattern^Idea.System.ZIF("ABC?D",1) -> .E1"ABC"1E1"D".E
and
MATCH(input,mask) ; matches input string against search mask
-> $$MATCH^Idea.System.ZIF("CSVZ","CST*")=0, $$MATCH^Idea.System.ZIF("CSVZ","CSV*")=1
MATCHOR(input,masklist) ; matches input string against list of search masks with OR condition (at least one)
-> $$MATCH^Idea.System.ZIF("CSVZ","CSV*,PF*")=1
MATCHAND(input,masklist) ; matches input string against list of search masks with AND condition (all must fit)
-> $$MATCH^Idea.System.ZIF("CSVZ","CSV*,PF*")=0
My implementation :