Announcement

Collapse
No announcement yet.

Conditional field jumps

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Conditional field jumps

    Conditional field jumps

    Conditional field jumping may be useful if you would like more control over where the cursor goes during Data Entry. In Screen Design, you can set the NextField value, but with conditional field jumps, you can set the focus to go to different fields depending on the value that was entered in the current field.

    To do this, use the field property, OnLostFocus to enter the code that will control the field jumps.

    The example below will set the next field depending on whether the value in the AE_Exist field is "Y" or "N". Here, if no AE's exist, then the focus will stay on the AE_Exist field.

    Code:
    /** OnLostFocus Method **/
    
    %include objfile;
    
    _OnLostFocus: method _self_:u:object;
    link createobj;
    ************************;
    ** Add user code here **;
    ************************;
    
    if ae_exists.text = "Y" then ae_number._goto();
    else if ae_exists.text = "N" then ae_exist._goto();
    
    endmethod;
    In the next example, we use the screen property OnLoad to set the focus on a particular field when a screen is first loaded, depending on whether we are on the first sequence or not.

    When on the first sequence, we will set the focus to the Patient_Initials field. Otherwise, we will skip the Patient_Initials field and set the focus to the AE_Exist field. In our hypothetical example, we would have set our screen to carry forward the Patient_Initials value from the previous sequence using the SequenceHeader field attribute.

    Code:
    /** onLoad Method **/
    
    %include objfile;
    
    _onLoad: method _self_:u:object;
    link createobj;
    ************************;
    ** Add user code here **;
    ************************;
    
    if sequence.text = 1 then patient_initials._goto();
    else if sequence.text > 1 then ae_exist._goto();
    
    endmethod;
    Last edited by Ronni Rubenstein; 10-29-2008, 01:36 PM.
Working...
X