AnsweredAssumed Answered

Picker Issue

Question asked by NaturSalus on Jan 18, 2012
Latest reply on Jan 19, 2012 by NaturSalus

Title

Picker Issue

Post

Hello,

I have a basic popup picker that does everything alright but consistently picking the selected value on the first try.

 

Tables:

Deviation

Originator

Person

  

Table Occurrences (TOs):

DEVIATION which is the TO of the Deviation table

deviation_ORIGINATOR which is the TO of the Originator table

deviation_originator_PERSON which is the TO of the Person table

 

Relationships:

 DEVIATION --< deviation_ORIGINATOR >-- deviation_originator_PERSON

DEVIATION::__kp_Deviation = deviation_ORIGINATOR::_kf_Deviation

deviation_originator::_kf_Person = deviation_originator_PERSON::__kp_Person

 

Layouts:

Deviation_Detail layout based on the DEVIATION TO

In the Body part of the Deviation_Detail layout there is the deviation_originator_PERSON::NameFirstLast field. On the upper right corner of this field there is a + button that triggers the Assign Person Originator Script

deviation_originator_PERSON layout based on the deviation_originator_PERSON TO

On the Header part there is a global field that triggers a Find script to search values in the deviation_originator_PERSON::NameFirstLast field

On the Body part there is deviation_originator_PERSON::NameFirstLast field and to the right side there is the Choose button that triggers the Resum Script script step.

On the Footer part there are the Cancel and New buttons.

 

 

Scripts:

Assign Person Originator

Select Person Originator

 

 

The  Assign Person Originator Script carries out two tasks:

First, performs the Select Person Originator Script

Second, gets the script result of the Select Person Originator Script, assigns it to the $PersonSelectedID local variable and finally sets the deviation_ORIGINATOR::_kf_Person =  $PersonSelectedID 

Select Person Originator Script:

# Error Handling
Allow User Abort [ Off ]
Set Error Capture [ On ]
#
Perform Script [ “Select Person Originator” ]
#
Set Variable [ $PersonSelectedID; Value:Get (ScriptResult) ]
If [ not IsEmpty ( $PersonSelectedID ) ]
// Refresh Window [ Flush cached join results; Flush cached external data ]
Set Field [ deviation_ORIGINATOR::_kf_Person; $PersonSelectedID ]
Commit Records/Requests [ No dialog ]
End If
Adjust Window [ Resize to Fit ]
Exit Script [ ]

 

I tried to add the Refresh Window script step to see if it fixed the issue, but it didn't

 

 The Select Person Originator Script  carries out the following tasks:

First, opens the deviation_originator_PERSON layout as a popup window

Second, pauses for the user to carry out desired actions.

Third, assigns the deviation_originator_PERSON__kp_Person value to the $PersonSelectedID local value

Select Person Originator Script:

# Error Handling
Set Error Capture [ On ]
Allow User Abort [ Off ]
#
New Window [ Name: "Select"; Height: 80; Width: 80; Top: 50; Left: 100 ]
Go to Layout [ “PersonPopUpSizer” (zRESOURCES) ]
Show/Hide Status Area [ Hide ]
Adjust Window [ Resize to Fit ]
Go to Layout [ “Select Originator” (deviation_originator_PERSON) ]
Sort Records [ Specified Sort Order: deviation_originator_PERSON::NameFirstLast; ascending ]
[ Restore; No dialog ]
Pause/Resume Script [ Indefinitely ]
#User clicks Select, New or Cancel
If [ Get ( ScriptResult) ≠ "Cancel" ]
Set Variable [ $PersonSelectedID; Value:deviation_originator_PERSON::__kp_Person ]
End If
# User clicks "cancel"
Close Window [ Current Window ]
Exit Script [ Result: $PersonSelectedID ]

 

THE ISSUE

Everything runs fine but picking the selected value on the deviation_originator_PERSON layout and putting it back on the deviation_originator_PERSON::NameFirstLast field that is on the  Deviation_Detail layout.

Sometimes it picks up the right value on the first try. Sometimes, it doesn't picks up the selected value.

Most of the time it takes some seconds for the selected value to show on the deviation_originator_PERSON::NameFirstLast field.

It never puts the wrong value on the deviation_originator_PERSON::NameFirstLast field. But sometimes you have to try two or three times till it does it right.

In a word, my current setting looks at least unstable.

 

Can you find out what is "wrong" with my current setting?

Is there another alternative and more relaible way of getting the same results?

 

Thanks,

 

natursalus

Outcomes