Proc Code to determine which "Entry" I'm in

Author: maciokr@natfuel.com (RobM)

In Uniface 9.6 does proc code exist that will allow me to determine which Entry I'm in?   Example: ; ========= Entry YouAreHere ; ========= Variables    String sEntryName EndVariables ; sEntryName would return "YouAreHere" sEntryName = $SomeUnifaceCallToDeterminEntryName   Return (sEntryName) ; =========

7 Comments

  1.  $proccontext("STACK") Will return a list of lists, either the first or the last item in the list is the current position, and one of the items within that will point to Operation, trigger or LPM.  Best to look at a few examples to find out.  As it provides a stack of all the bits, you can write it in to a global proc and then take the second to last entry (which will be where it was called from) rather than the last entry (which will always be the global proc...). Saves writing the same code many times. 


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  2. Works great but my list returns the info I'm looking for in the first entry:   "TYPE=MOD·!·;MODID=mWHEREAMI·!·;MODNAM=WHEREAMI·!·;TRIG=_detail·!·;TRIGGER=DTLF·!·;LNR=1·!·;LIN=SPROCINFO = $proccontext("STACK")·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=XRMF0004·!·;INSNAM=XRMF0004·!·;FIELD=PROCCNTXT·!·;ENTITY=D_DUMMY·!·;MODEL=NFG_TMPL·;TYPE=TRG·!·;MODID=t3\DTLF·!·;MODNAM=DTLF·!·;TRIG=_detail·!·;TRIGGER=DTLF·!·;LNR=2·!·;LIN=call WHEREAMI()·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=XRMF0004·!·;INSNAM=XRMF0004·!·;FIELD=PROCCNTXT·!·;ENTITY=D_DUMMY·!·;MODEL=NFG_TMPL·;TYPE=TRG·!·;MODID=tEXEC·!·;MODNAM=EXEC·!·;TRIG=_execute·!·;TRIGGER=EXEC·!·;LNR=3·!·;LIN=edit ·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=XRMF0004·!·;INSNAM=XRMF0004·;TYPE=MOD·!·;MODID=mACTTESTFORM·!·;MODNAM=ACTTESTFORM·!·;TRIG=_execute·!·;TRIGGER=EXEC·!·;LNR=15·!·;LIN=activate $P_FORMNAME$."EXEC"(  ) ·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=UUEXTN65·!·;INSNAM=UUEXTN65·;TYPE=MOD·!·;MODID=mRUNTESTFORM·!·;MODNAM=RUNTESTFORM·!·;TRIG=_execute·!·;TRIGGER=EXEC·!·;LNR=19·!·;LIN=call ACTTESTFORM(STRWEBRETURN)·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=UUEXTN65·!·;INSNAM=UUEXTN65·;TYPE=MOD·!·;MODID=mTESTFORM·!·;MODNAM=TESTFORM·!·;TRIG=_execute·!·;TRIGGER=EXEC·!·;LNR=1·!·;LIN=call RUNTESTFORM(NUMTERMINATE,NUMMESSAGE,STRRESULT)·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=UUEXTN65·!·;INSNAM=UUEXTN65·;TYPE=MOD·!·;MODID=mDO_TEST·!·;MODNAM=DO_TEST·!·;TRIG=_execute·!·;TRIGGER=EXEC·!·;LNR=14·!·;LIN=call TESTFORM()·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=UUEXTN65·!·;INSNAM=UUEXTN65·;TYPE=MOD·!·;MODID=mDO_PROCESS·!·;MODNAM=DO_PROCESS·!·;TRIG=_execute·!·;TRIGGER=EXEC·!·;LNR=17·!·;LIN=call DO_TEST()·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=UUEXTN65·!·;INSNAM=UUEXTN65·;TYPE=TRG·!·;MODID=tEXEC·!·;MODNAM=EXEC·!·;TRIG=_execute·!·;TRIGGER=EXEC·!·;LNR=48·!·;LIN=call DO_PROCESS()·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=UUEXTN65·!·;INSNAM=UUEXTN65·;TYPE=MOD·!·;MODID=mRUNFORM·!·;MODNAM=RUNFORM·!·;TRIG=_menu·!·;TRIGGER=MNUS·!·;LNR=16·!·;LIN=activate "%%$LP_4S$"."EXEC"(  ) ·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=UUEXTN23·!·;INSNAM=UUEXTN23·;TYPE=MOD·!·;MODID=mMY_RUNFORM·!·;MODNAM=MY_RUNFORM·!·;TRIG=_menu·!·;TRIGGER=MNUS·!·;LNR=257·!·;LIN=call RUNFORM()·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=UUEXTN23·!·;INSNAM=UUEXTN23·;TYPE=MOD·!·;MODID=mUFORM_TEST·!·;MODNAM=UFORM_TEST·!·;TRIG=_menu·!·;TRIGGER=MNUS·!·;LNR=14·!·;LIN=call MY_RUNFORM()·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=UUEXTN23·!·;INSNAM=UUEXTN23·;TYPE=TRG·!·;MODID=tMNUS·!·;MODNAM=MNUS·!·;TRIG=_menu·!·;TRIGGER=MNUS·!·;LNR=150·!·;LIN=call UFORM_TEST()·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=UUEXTN23·!·;INSNAM=UUEXTN23·;TYPE=TRG·!·;MODID=tEXEC·!·;MODNAM=EXEC·!·;TRIG=_execute·!·;TRIGGER=EXEC·!·;LNR=75·!·;LIN=edit ·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=UUEXTN23·!·;INSNAM=UUEXTN23·;TYPE=MOD·!·;MODID=mRUNFORM·!·;MODNAM=RUNFORM·!·;TRIG=_execute·!·;TRIGGER=EXEC·!·;LNR=4·!·;LIN=activate "%%$LP_4S$"."EXEC"(  ) ·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=UUEXTN04·!·;INSNAM=UUEXTN04·;TYPE=MOD·!·;MODID=mDO_PROCESS·!·;MODNAM=DO_PROCESS·!·;TRIG=_execute·!·;TRIGGER=EXEC·!·;LNR=20·!·;LIN=call RUNFORM()·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=UUEXTN04·!·;INSNAM=UUEXTN04·;TYPE=TRG·!·;MODID=tEXEC·!·;MODNAM=EXEC·!·;TRIG=_execute·!·;TRIGGER=EXEC·!·;LNR=77·!·;LIN=call DO_PROCESS()·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=UUEXTN04·!·;INSNAM=UUEXTN04·;TYPE=MOD·!·;MODID=mDO_PROCESS·!·;MODNAM=DO_PROCESS·!·;TRIG=_execute·!·;TRIGGER=EXEC·!·;LNR=7·!·;LIN=activate "%%$CUR_FORMNAME$"."EXEC"(  ) ·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=UUEXTN00·!·;INSNAM=UUEXTN00·;TYPE=TRG·!·;MODID=tEXEC·!·;MODNAM=EXEC·!·;TRIG=_execute·!·;TRIGGER=EXEC·!·;LNR=40·!·;LIN=call DO_PROCESS()·!·;OBJTYPE=FRM·!·;APSNAM=IDF·!·;CPTNAM=UUEXTN00·!·;INSNAM=UUEXTN00·;TYPE=MOD·!·;MODID=mSTARTFORM·!·;MODNAM=STARTFORM·!·;TRIG=_application_exec·!·;TRIGGER=APPL·!·;LNR=11·!·;LIN=activate $81."EXEC"(  ) ·!·;OBJTYPE=APS·!·;APSNAM=IDF·!·;CPTNAM=IDF·;TYPE=MOD·!·;MODID=mSTART_UDE·!·;MODNAM=START_UDE·!·;TRIG=_application_exec·!·;TRIGGER=APPL·!·;LNR=9·!·;LIN=call STARTFORM()·!·;OBJTYPE=APS·!·;APSNAM=IDF·!·;CPTNAM=IDF·;TYPE=TRG·!·;MODID=tAPPL·!·;MODNAM=APPL·!·;TRIG=_application_exec·!·;TRIGGER=APPL·!·;LNR=38·!·;LIN=call START_UDE()·!·;OBJTYPE=APS·!·;APSNAM=IDF·!·;CPTNAM=IDF"


    Author: RobM (maciokr@natfuel.com)
  3. Yeah, I couldn't remember which way round it provided the information. Looks like it's current, then parent, then grandparent etc.  So if it's in a global proc, the answer to where that was called from is the second entry. (In this case, line 2 of the detail trigger of PROCCNTXT.D_DUMMY.NFG_TMPL in component XRMF0004).  What I am not sure about is how you would go about calling this, when you don't know where you're calling it from, although this has the advantage of being able to tell you where that was called from and so on back to the beginning.  An alternative is to use the compile time constants <$triggerabbr>, <$entname>, <$fieldname> and <$componentname> in the call to your message routine.    Message (or askess, or putmess) "Hi, I am calling from <$triggerabbr>,<$entname>,<$fieldname>, <$componentname> " Iain


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  4. This seems to work in all cases (taking MODNAM from the first entry:   Entry WhereAmI Variables String sProcInfo String sList String sModNam EndVariables sProcInfo = $ProcContext("STACK")   GetItem sList, sProcInfo, 1 ;sList = "TYPE=MOD·;MODID=mWHEREAMI·;MODNAM=WHEREAMI·;TRIG=_detail·;TRIGGER=DTLF·;LNR=1·;LIN=SPROCINFO = $proccontext("STACK")·;OBJTYPE=FRM·;APSNAM=IDF·;CPTNAM=XRMF0004·;INSNAM=XRMF0004·;FIELD=PROCCNTXT·;ENTITY=D_DUMMY·;MODEL=NFG_TMPL"   GetItem/Id sModNam, sList, "MODNAM" ; sModNam = "WHEREAMI"   Return (0)


    Author: RobM (maciokr@natfuel.com)
  5. ...But I understand that I should use the second entry when I place this in a global routine.   Thanx for your help! .Rob..


    Author: RobM (maciokr@natfuel.com)
  6. One more question:  I find no documented Uniface reference to $proccontext.  Any web reference states it's not officially supported so there's no guarantee of future inclusion.  I want to build a global error processing routine using $proccontext but am hesitant to use it if it's not officially supported and could disappear during a future Uniface update/release.   Your thoughts please...


    Author: RobM (maciokr@natfuel.com)
  7. The function $proccontext is also used (internally) by Uniface 10. So it should be quite "safe" to use it for the time being. But then again: Uniface reserves the right to change or remove the mentioned functionality from a future version of the product without any previous notice or warning. Hope this helps. Daniel


    Author: diseli (daniel.iseli@uniface.com)