AnsweredAssumed Answered

Tab navigation

Question asked by tays01s on May 2, 2017
Latest reply on May 3, 2017 by tays01s

I am trying to set the first record in 2 related portals and the layout of a related table using an OnObjectModify trigger for the panel:

Go to Object [ Object Name: "calc 2" ]

Go to Portal Row [ Select; First ]
Perform Script [ “Select Calc IO” ]

 

This does the job but gets stuck in a loop because of the OnPanel script trigger:

 

Commit Records/Requests

[ No dialog ]
If [ $$Cancel_StayOnTab=1 ]

Exit Script [ ] End If

If [ GetValue (Get(TriggerCurrentPanel);2)="tab_calcs" and

(
IsEmpty(Calc_n::cm) or IsEmpty(Calc_n::kg)
)]

Show Custom Dialog [ Title: "Complete Calc info"; Message: "You should complete critical fields before leaving this tab:"&¶ & If(IsEmpty(Calc_n::cm);"cm";"") &¶ &
If(IsEmpty(Calc_n::kg);"kg";""); Default Button: “Complete”, Commit: “Yes”; Button 2: “Switch tab”, Commit: “Yes” ]

#Get(LastMessageChoice) results in True/False #Choosing 'Complete' (=1) = False and causes Exit. Exit Script [ Result: Get ( LastMessageChoice ) = 2 ]

Else If [ GetValue ( Get ( TriggerCurrentPanel );2 ) ="tab_patient" and

(
IsEmpty(Patient::Lastname) or IsEmpty(Patient::Firstname) or IsEmpty(Patient::Health_ID) or IsEmpty(Patient::Unit) or IsEmpty(Patient::Ethnicity) or IsEmpty(Patient::BirthDate) or IsEmpty(Patient::Sex)
)]

Show Custom Dialog [ Title: "Complete patient info"; Message: "You must complete critical fields before leaving this tab:"&¶ & If(IsEmpty(Patient::Lastname);"Lastname";"") &¶ &
If(IsEmpty(Patient::Firstname);"Firstname";"")

Default Button: “Complete”, Commit: “Yes”; Button 2: “Switch tab”, Commit: “Yes” ]

Exit Script [ Result: Get ( LastMessageChoice ) = 2 ]

 

 

I tried using the following top/tail script lines to the first script steps but without success:

Set Variable [ $$Cancel_StayOnTab; Value:1 ]

Set Variable [ $$Cancel_StayOnTab; Value:0 ]

 

How do I avoid this loop?


Outcomes