User bio
404 bio not found
Member since Nov 9, 2022
Replies:

You only need to install this in one place, in the last method or routine call in your call stack. If your stack is like this AAA -> BBB -> CCC^ABC -> XXX^XYZ, then you need to put Stuart's code in a method called by XXX^XYZ

For example, assume you have these classmethods

ClassMethod GrandParent()
{
    do ..Parent()
}
ClassMethod Parent()
{
    do ..Child()
}
ClassMethod Child()
{
    do ..Inspector()
}
ClassMethod Inspector()
{
    FOR i=0:1:$STACK(-1)-1 {
      SET s=$STACK(i,"PLACE")
      SET retloc=$PIECE(s," ")
      TRY { SET code=$TEXT(@retloc) } CATCH { SET code="n/a" }
      WRITE !,retloc," (",$PIECE(s," ",2),") -> ",code
    }
}

Then if you call GrandParent(), then it will print this:

@ (+1) -> n/a
GrandParent+1^Sample.Test.1 (+1) ->     do ..Parent() }
Parent+1^Sample.Test.1 (+1) ->     do ..Child() }
Child+1^Sample.Test.1 (+1) ->     do ..Inspector() }
Certifications & Credly badges:
Ali has no Certifications & Credly badges yet.
Global Masters badges:
Followers:
Ali has no followers yet.
Following:
Ali has not followed anybody yet.