Written by

Question OHAD Saa · Dec 14, 2023

how to exclude row after checking its data

This question originally appeared in the comments of the post: The Art of Mapping Globals to Classes (5 of 3)
 

Hey

I need to know how to exclude row after checking his data, for example:

^global(1,2)=a*b

^global(1,3)=a*c

if $P(^global(key1,key2),"*",2)=c Q

how can i do this?

thanks

Comments

Timo Lindenschmid · Dec 15, 2023

No t100% sure what you are after but if you just want to generalize the if then something like this will do:

set key1=1
set key2=2

if ($piece($get(^global(@key1,@key2)),"*",2)=c) { quit }
0
Daniel Aguilar · Dec 15, 2023

I think we need more context but in case you were iterating the global you could do this:

Set key2=""
For{
    Set key2=$O(^global(key1,key2))
    Quit:key2=""
    Continue:($G(^global(key1,key2))=c) // will skip this node and continue with next
    ...
    
}

If there isn't an iteration you could do:

^global(1,2)=a*b

^global(1,3)=a*c

Q:($P(^global(key1,key2),"*",2)=c)
0
OHAD Saa · Dec 17, 2023

thank you for your answer

originaly I wrote the question in the page related to mapping a global to SQL

and that's where I want to do this filter.
where can I write the code for it?
how can I refer to a pice inside the global while mapping?

thanks

0