Uniface User Forum

 View Only
Expand all | Collapse all

Read trigger fires on clear/e

  • 1.  Read trigger fires on clear/e

    Posted 08-03-2021 10:22

    Hi Experts,

    Thanks for help in advance!

    I have a button on screen which when clicked will clear/e and retrieve/e data for an entity filter applied using inputs from master entity. The problem is in some cases data is not fetched when debug found that when clear/e statement is executed read trigger fires and populates data and next when retrieve/e statement is executing error (ERROR:2, MNEM: <UIOSERR_OCC_NOT_FOUND>, DESCRIPTION: Occurrence not found)  is thrown and finally no data is fetched. 

    can anyone please help understand what could be cause of issue and is it possible that read trigger fire when clear/e is executed?


    Thanks,

    Imran.



  • 2.  RE: Read trigger fires on clear/e

    Posted 08-03-2021 11:17

    Hi Imran

    start the detail-trigger of the button with

    $proc_tracing = 1
    $traceprint = 1023

    Now you should see in the LOG-file which statement really fires a (unwanted) retrieve 🙂


    don't forget to set

    $proc_tracing = 0
    $traceprint = 0

    at the end of the detail-trigger, else you got MB of text in LOG-File


    Ingo




  • 3.  RE: Read trigger fires on clear/e

    Posted 08-03-2021 14:45

    Should be $ioprint instead of $traceprint



  • 4.  RE: Read trigger fires on clear/e

    Posted 08-03-2021 16:38

    Yes and no 🙂
    I want to see, which code is executed. Which one fires the retrieve/read-trigger?
    But $ioprint=1023 could also be a hint
    Ingo



  • 5.  RE: Read trigger fires on clear/e

    Posted 08-05-2021 07:41

    Hi Ingo,

    below is log file content that shows read trigger called due to clear, please suggest!


    "Status:0, DBError:0" (_detail); DTLF; 2; [0]; $traceprint = 1023
    "Status:0, DBError:0" (_detail); DTLF; 3; [0]; setocc "ENTY1", $curocc(ENTY1.CSPRD) + 1
    "Status:0, DBError:0" (_read); READ; 1; [0]; if ($curocc(ENTY2.CSPRD) > $NUMBER_EMPTY$ + $NUMBER_EXTRA$)
    "Status:0, DBError:0" (_read); READ; 2; [0]; if ($curocc(ENTY2.CSPRD) = $NUMBER_EMPTY$ + $NUMBER_EXTRA$ + 1)
    "Status:0, DBError:0" (_read); READ; 3; [0]; $LAST_PARENT$ = 0
    "Status:0, DBError:0" (_read); READ; 4; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 5; [0]; read  u_where(((_ID.ENTY1 = _ID.ENTY2) & (_PARENT.PRD
    "Status:0, DBError:0" (_read); READ; 6; [0]; if ($status = 0)
    "Status:0, DBError:0" (_read); READ; 7; [0]; $LAST_PARENT$ = _CHILD.ENTY1
    "Status:0, DBError:0" (_read); READ; 8; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 9; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 10; [0]; done<end of="" module=""> 
    "Status:2, DBError:0" (_detail); DTLF; 4; [0]; if ($status < 0)
    "Status:2, DBError:0" (_detail); DTLF; 6; [0]; endif 
    "Status:2, DBError:0" (_detail); DTLF; 7; [0]; $LAST_PARENT$ = _CHILD.ENTY1
    "Status:2, DBError:0" (_detail); DTLF; 8; [0]; call LOAD_LOWERS()
    "Status:0, DBError:0" (_detail); LOAD_LOWERS; 1; [0]; if ($curocc(ENTY2.CSPRD) < $hits(ENTY2.CSPRD) + $NUMBER_EMPTY$ + $NUMBER_E
    "Status:0, DBError:0" (_detail); LOAD_LOWERS; 2; [0]; $1 = $curocc(ENTY2.CSPRD) + 1
    "Status:0, DBError:0" (_detail); LOAD_LOWERS; 3; [0]; repeat 
    "Status:0, DBError:0" (_detail); LOAD_LOWERS; 4; [0]; setocc "ENTY2", $1
    "Status:6, DBError:0" (_detail); LOAD_LOWERS; 5; [0]; clear/e "ENTY1"
    "Status:0, DBError:0" (_read); READ; 1; [0]; if ($curocc(ENTY2.CSPRD) > $NUMBER_EMPTY$ + $NUMBER_EXTRA$)
    "Status:0, DBError:0" (_read); READ; 2; [0]; if ($curocc(ENTY2.CSPRD) = $NUMBER_EMPTY$ + $NUMBER_EXTRA$ + 1)
    "Status:0, DBError:0" (_read); READ; 4; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 5; [0]; read  u_where(((_ID.ENTY1 = _ID.ENTY2) & (_PARENT.PRD
    "Status:0, DBError:0" (_read); READ; 6; [0]; if ($status = 0)
    "Status:0, DBError:0" (_read); READ; 7; [0]; $LAST_PARENT$ = _CHILD.ENTY1
    "Status:0, DBError:0" (_read); READ; 8; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 9; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 10; [0]; done<end of="" module=""> 
    "Status:0, DBError:0" (_detail); LOAD_LOWERS; 6; [0]; retrieve/e "ENTY1"
    "Status:0, DBError:0" (_read); READ; 1; [0]; if ($curocc(ENTY2.CSPRD) > $NUMBER_EMPTY$ + $NUMBER_EXTRA$)
    "Status:0, DBError:0" (_read); READ; 2; [0]; if ($curocc(ENTY2.CSPRD) = $NUMBER_EMPTY$ + $NUMBER_EXTRA$ + 1)
    "Status:0, DBError:0" (_read); READ; 4; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 5; [0]; read  u_where(((_ID.ENTY1 = _ID.ENTY2) & (_PARENT.PRD
    "Status:-2, DBError:0" (_read); READ; 6; [-2]; if ($status = 0)
    "Status:-2, DBError:0" (_read); READ; 8; [-2]; endif 
    "Status:-2, DBError:0" (_read); READ; 9; [-2]; endif 
    "Status:-2, DBError:0" (_read); READ; 10; [-2]; done<end of="" module=""> 
    "Status:-2, DBError:0" (_detail); LOAD_LOWERS; 7; [-2]; $1 = $1 + 1
    "Status:-2, DBError:0" (_detail); LOAD_LOWERS; 8; [-2]; until ($1 > $hits(ENTY2.CSPRD) + $NUMBER_EMPTY$ + $NUMBER_EXTRA$)
    "Status:-2, DBError:0" (_detail); LOAD_LOWERS; 3; [-2]; repeat 
    "Status:-2, DBError:0" (_detail); LOAD_LOWERS; 4; [-2]; setocc "ENTY2", $1
    "Status:7, DBError:0" (_detail); LOAD_LOWERS; 5; [0]; clear/e "ENTY1"
    "Status:0, DBError:0" (_read); READ; 1; [0]; if ($curocc(ENTY2.CSPRD) > $NUMBER_EMPTY$ + $NUMBER_EXTRA$)
    "Status:0, DBError:0" (_read); READ; 2; [0]; if ($curocc(ENTY2.CSPRD) = $NUMBER_EMPTY$ + $NUMBER_EXTRA$ + 1)
    "Status:0, DBError:0" (_read); READ; 4; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 5; [0]; read  u_where(((_ID.ENTY1 = _ID.ENTY2) & (_PARENT.PRD
    "Status:0, DBError:0" (_read); READ; 6; [0]; if ($status = 0)
    "Status:0, DBError:0" (_read); READ; 7; [0]; $LAST_PARENT$ = _CHILD.ENTY1
    "Status:0, DBError:0" (_read); READ; 8; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 9; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 10; [0]; done<end of="" module=""> 
    "Status:0, DBError:0" (_detail); LOAD_LOWERS; 6; [0]; retrieve/e "ENTY1"
    "Status:0, DBError:0" (_read); READ; 1; [0]; if ($curocc(ENTY2.CSPRD) > $NUMBER_EMPTY$ + $NUMBER_EXTRA$)
    "Status:0, DBError:0" (_read); READ; 2; [0]; if ($curocc(ENTY2.CSPRD) = $NUMBER_EMPTY$ + $NUMBER_EXTRA$ + 1)
    "Status:0, DBError:0" (_read); READ; 4; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 5; [0]; read  u_where(((_ID.ENTY1 = _ID.ENTY2) & (_PARENT.PRD
    "Status:-2, DBError:0" (_read); READ; 6; [-2]; if ($status = 0)
    "Status:-2, DBError:0" (_read); READ; 8; [-2]; endif 
    "Status:-2, DBError:0" (_read); READ; 9; [-2]; endif 
    "Status:-2, DBError:0" (_read); READ; 10; [-2]; done<end of="" module=""> 
    "Status:-2, DBError:0" (_detail); LOAD_LOWERS; 7; [-2]; $1 = $1 + 1
    "Status:-2, DBError:0" (_detail); LOAD_LOWERS; 8; [-2]; until ($1 > $hits(ENTY2.CSPRD) + $NUMBER_EMPTY$ + $NUMBER_EXTRA$)
    "Status:-2, DBError:0" (_detail); LOAD_LOWERS; 3; [-2]; repeat 
    "Status:-2, DBError:0" (_detail); LOAD_LOWERS; 4; [-2]; setocc "ENTY2", $1
    "Status:8, DBError:0" (_detail); LOAD_LOWERS; 5; [0]; clear/e "ENTY1"
    "Status:0, DBError:0" (_read); READ; 1; [0]; if ($curocc(ENTY2.CSPRD) > $NUMBER_EMPTY$ + $NUMBER_EXTRA$)
    "Status:0, DBError:0" (_read); READ; 2; [0]; if ($curocc(ENTY2.CSPRD) = $NUMBER_EMPTY$ + $NUMBER_EXTRA$ + 1)
    "Status:0, DBError:0" (_read); READ; 4; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 5; [0]; read  u_where(((_ID.ENTY1 = _ID.ENTY2) & (_PARENT.PRD
    "Status:0, DBError:0" (_read); READ; 6; [0]; if ($status = 0)
    "Status:0, DBError:0" (_read); READ; 7; [0]; $LAST_PARENT$ = _CHILD.ENTY1
    "Status:0, DBError:0" (_read); READ; 8; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 9; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 10; [0]; done<end of="" module=""> 
    "Status:0, DBError:0" (_detail); LOAD_LOWERS; 6; [0]; retrieve/e "ENTY1"
    "Status:0, DBError:0" (_read); READ; 1; [0]; if ($curocc(ENTY2.CSPRD) > $NUMBER_EMPTY$ + $NUMBER_EXTRA$)
    "Status:0, DBError:0" (_read); READ; 2; [0]; if ($curocc(ENTY2.CSPRD) = $NUMBER_EMPTY$ + $NUMBER_EXTRA$ + 1)
    "Status:0, DBError:0" (_read); READ; 4; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 5; [0]; read  u_where(((_ID.ENTY1 = _ID.ENTY2) & (_PARENT.PRD
    "Status:-2, DBError:0" (_read); READ; 6; [-2]; if ($status = 0)
    "Status:-2, DBError:0" (_read); READ; 8; [-2]; endif 
    "Status:-2, DBError:0" (_read); READ; 9; [-2]; endif 
    "Status:-2, DBError:0" (_read); READ; 10; [-2]; done<end of="" module=""> 
    "Status:-2, DBError:0" (_detail); LOAD_LOWERS; 7; [-2]; $1 = $1 + 1
    "Status:-2, DBError:0" (_detail); LOAD_LOWERS; 8; [-2]; until ($1 > $hits(ENTY2.CSPRD) + $NUMBER_EMPTY$ + $NUMBER_EXTRA$)
    "Status:-2, DBError:0" (_detail); LOAD_LOWERS; 3; [-2]; repeat 
    "Status:-2, DBError:0" (_detail); LOAD_LOWERS; 4; [-2]; setocc "ENTY2", $1
    "Status:9, DBError:0" (_detail); LOAD_LOWERS; 5; [0]; clear/e "ENTY1"
    "Status:0, DBError:0" (_read); READ; 1; [0]; if ($curocc(ENTY2.CSPRD) > $NUMBER_EMPTY$ + $NUMBER_EXTRA$)
    "Status:0, DBError:0" (_read); READ; 2; [0]; if ($curocc(ENTY2.CSPRD) = $NUMBER_EMPTY$ + $NUMBER_EXTRA$ + 1)
    "Status:0, DBError:0" (_read); READ; 4; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 5; [0]; read  u_where(((_ID.ENTY1 = _ID.ENTY2) & (_PARENT.PRD
    "Status:0, DBError:0" (_read); READ; 6; [0]; if ($status = 0)
    "Status:0, DBError:0" (_read); READ; 7; [0]; $LAST_PARENT$ = _CHILD.ENTY1
    "Status:0, DBError:0" (_read); READ; 8; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 9; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 10; [0]; done<end of="" module=""> 
    "Status:0, DBError:0" (_detail); LOAD_LOWERS; 6; [0]; retrieve/e "ENTY1"
    "Status:0, DBError:0" (_read); READ; 1; [0]; if ($curocc(ENTY2.CSPRD) > $NUMBER_EMPTY$ + $NUMBER_EXTRA$)
    "Status:0, DBError:0" (_read); READ; 2; [0]; if ($curocc(ENTY2.CSPRD) = $NUMBER_EMPTY$ + $NUMBER_EXTRA$ + 1)
    "Status:0, DBError:0" (_read); READ; 4; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 5; [0]; read  u_where(((_ID.ENTY1 = _ID.ENTY2) & (_PARENT.PRD
    "Status:-2, DBError:0" (_read); READ; 6; [-2]; if ($status = 0)
    "Status:-2, DBError:0" (_read); READ; 8; [-2]; endif 
    "Status:-2, DBError:0" (_read); READ; 9; [-2]; endif 
    "Status:-2, DBError:0" (_read); READ; 10; [-2]; done<end of="" module=""> 
    "Status:-2, DBError:0" (_detail); LOAD_LOWERS; 7; [-2]; $1 = $1 + 1
    "Status:-2, DBError:0" (_detail); LOAD_LOWERS; 8; [-2]; until ($1 > $hits(ENTY2.CSPRD) + $NUMBER_EMPTY$ + $NUMBER_EXTRA$)
    "Status:-2, DBError:0" (_detail); LOAD_LOWERS; 9; [-2]; endif 
    "Status:-2, DBError:0" (_detail); LOAD_LOWERS; 10; [-2]; done<end of="" module=""> 
    "Status:-2, DBError:0" (_detail); DTLF; 9; [0]; setocc "ENTY2", $OCC_LAST$
    "Status:5, DBError:0" (_detail); DTLF; 10; [0]; call LOAD_ENTY3()
    "Status:0, DBError:0" (_detail); LOAD_ENTY3; 1; [0]; if ($curocc(ENTY2.CSPRD) = $OCC_LAST$)
    "Status:0, DBError:0" (_detail); LOAD_ENTY3; 2; [0]; fieldsyntax "start_number", "   "
    "Status:0, DBError:0" (_detail); LOAD_ENTY3; 3; [0]; fieldvideo "start_number", "DEF"
    "Status:0, DBError:0" (_detail); LOAD_ENTY3; 4; [0]; START_NUMBER.DUMMY = 0
    "Status:0, DBError:0" (_detail); LOAD_ENTY3; 5; [0]; $READ_KEY$ = "mste1"
    "Status:0, DBError:0" (_detail); LOAD_ENTY3; 6; [0]; $PARENT_NUMBER$ = _CHILD.ENTY1
    "Status:0, DBError:0" (_detail); LOAD_ENTY3; 7; [0]; clear/e "ENTY3"
    "Status:0, DBError:0" (_detail); LOAD_ENTY3; 8; [0]; retrieve/e "ENTY3"
    "Status:0, DBError:0" (_read); READ; 1; [0]; if (START_NUMBER.DUMMY > 0 & START_NAME.DUMMY = '')
    "Status:0, DBError:0" (_read); READ; 3; [0]; else 
    "Status:0, DBError:0" (_read); READ; 4; [0]; if (START_NAME.DUMMY != '')
    "Status:0, DBError:0" (_read); READ; 6; [0]; else 
    "Status:0, DBError:0" (_read); READ; 7; [0]; read  u_where((_PARENT.ENTY3 = $PARENT_NUMBER$)) order by "_fu
    "Status:0, DBError:0" (_read); READ; 8; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 9; [0]; endif 
    "Status:0, DBError:0" (_read); READ; 10; [0]; done<end of="" module=""> 
    "Status:0, DBError:0" (_detail); LOAD_ENTY3; 9; [0]; if ($hits(ENTY3.CSPRD) = 0)
    "Status:0, DBError:0" (_detail); LOAD_ENTY3; 11; [0]; endif 
    "Status:0, DBError:0" (_detail); LOAD_ENTY3; 12; [0]; if (_CHILD.ENTY3 > 1)
    "Status:0, DBError:0" (_detail); LOAD_ENTY3; 13; [0]; $prompt = _FULL.ENTY3
    "Status:0, DBError:0" (_detail); LOAD_ENTY3; 16; [0]; endif 
    "Status:0, DBError:0" (_detail); LOAD_ENTY3; 17; [0]; endif 
    "Status:0, DBError:0" (_detail); LOAD_ENTY3; 18; [0]; done<end of="" module=""> 
    "Status:0, DBError:0" (_detail); DTLF; 11; [0]; $proc_tracing = 0
    
    ]] ></end></end></end></end></end></end></end></end></end></end></end></end>

    thanks



  • 6.  RE: Read trigger fires on clear/e

    Posted 08-05-2021 07:58

    Hi Imran

    a) Are ENT1 or ENT2 are painted inside the other?
    b) Is there a relationship between ENT1 and ENT2?

    Ingo



  • 7.  RE: Read trigger fires on clear/e

    Posted 08-05-2021 09:31

    Hi Ingo,

    a) yes, ENT1 is painted inside ENT2.

    b) In read trigger of ENT1 filter criteria applied using _ID from ENT2

    (_ID.ENTY1 = _ID.ENTY2)


    Imran.



  • 8.  RE: Read trigger fires on clear/e

    Posted 08-05-2021 10:11

    Hi Imran

    Okay, you "define" a relation between this two entities by U_WHERE
    But in the model,
    a) are the keys proper defined
    b) is there a relation (in model, not in the component)

    Ingo



  • 9.  RE: Read trigger fires on clear/e

    Posted 08-05-2021 12:56

    a) Yes keys are defined in model for both the entities.

    b) There is no relation defined in model between both the entities ENT1 and ENT2.

    but there are four relationships defined in model for ENT2 for other entities and one of them(ENT4) is also painted inside ENT2.

    Hope this answers, please let me know if need more information.

    thanks!



  • 10.  RE: Read trigger fires on clear/e

    Posted 08-05-2021 13:36

    Hi Imran,

    I honestly find your code what we call ...ehm ...spaghetti mode... (sorry for being brutally honest here!) ...but anyhow IMHO:

    if ENT1 is picted inside ENT2 probably the read trigger of ENT1 is NOT activated from clear/e but from the previous instruction (module LOAD LOWERS line 4):

    setocc "ENTY2", $1

    because when you change current occ of an external entity Uniface initially reposition itself on it and only later it starts reading about consequences of the repositioning.

    To verify this hypothesis try to add a reference to ENTY1:

    putmess _ID.ENTY1

    into line 5 of module LOAD_LOWERS just after that setocc line and probably you will see read trigger of ENTY1 starting before your clear/e.

    Just 2 cents here ...

    Gianni



  • 11.  RE: Read trigger fires on clear/e

    Posted 08-03-2021 11:43

    Hi Imran,

    I suspect you have defined an "Initial value" for those fields "automagically" used as filters.

    Try to check your sources about it...

    Regards,

    Gianni




  • 12.  RE: Read trigger fires on clear/e

    Posted 08-05-2021 07:44

    Hi Gianni,


    As I am new to uniface not sure where do I check initial value of what? Others in my team also are not sure about this behavior.


    please let me know if you want me to check any specific property/attribute.


    thanks! 



  • 13.  RE: Read trigger fires on clear/e

    Posted 08-07-2021 12:35

    Hi Gianni,


    yeah 🙂 you may be right, this is a legacy application so . . .


    I was unable to understand the behavior but as work around created form variable which is set on/off before and after clear/e statement and used it in read trigger to conditionally execute code hence avoiding code execution when read fires due to clear/e. This has solved the issue. 




  • 14.  RE: Read trigger fires on clear/e

    Posted 08-08-2021 10:15

    Hi Imran,

    happy to have help you somehow... 🙂

    Anyhow if you want to have a look to more info on "Initial Value" field property could be found here.

    Enjoy!

    Best regards,
    Gianni