User bio
404 bio not found
Member since Jan 4, 2017
Pavel has not published any posts yet.

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


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 :

 MaskToPattern(mask,sw) pattern,char,pos pattern="",char="" pos=1:1:$L(mask) D
 . $E(mask,pos)="*" pattern=pattern_$S(char="":"",1:"1"""_char_"""")_".E",char="" Q
 . $E(mask,pos)="?" pattern=pattern_$S(char="":"",1:"1"""_char_"""")_"1E",char="" Q
 . char=char_$E(mask,pos)
 pattern=pattern_$S(char="":"",1:"1"""_char_""""),char="" S:$G(sw) pattern=".E"_pattern_".E"

MATCH(input,mask) input?@$$MaskToPattern^Idea.System.ZIF(mask)
MATCHOR(input,list) ok,pie,mask ok=0 pie=1:1:$L(list,",") mask=$P(list,",",pie) mask'="",$$MATCH^Idea.System.ZIF(input,mask) ok=1 Q
MATCHAND(input,list) ok,pie,mask ok=1 pie=1:1:$L(list,",") mask=$P(list,",",pie) mask'="",'$$MATCH^Idea.System.ZIF(input,mask) ok=0 Q

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.

Pavel has no followers yet.
Pavel has not followed anybody yet.
Global Masters badges: