Ram�n Jim�nez wrote:
> when I was (even more of a) rookie

If that's the case, I'm a newborn...

is it safe to kill and set a global within a $O() traversal? I mean, I'm not sure in this particular case, but in general what would happen if the newly set node collates before the next node to be visited?

That's a very good point; I think I just got "lucky" because I had
(a lot) more children per parent than parents, and I originally added PINs to my first Business--


BUT if my PIN data was like

1: PIN assigned to School 1
2: PIN assigned to School 4
3: PIN asssigned to School 1 (!)
...

my nodes would (after processing #3) be

(1,1)
(1,3)
(4)
(4,2)
(5)
...

So there would be serious trouble down the road.

The routine probably can be saved by looking at
oldPINId right after

 Set oldPINId=$O(^ooPINsD(oldPINId))

to make sure it isn't a subnode, like (if the ids are integers):

If ($ISVALIDNUM(oldPINId)) {
  ;put the rest of the loop here
  ...

Or just

Set oldPINId=$I(oldPINId)
If ($DATA(oldPINId) = 1)||($DATA(oldPINId) = 11) {
  ;put the rest of the loop here
  ...


Thanks!

Dave



Reply via email to