Calendar Date Picker Object

Many people ask if there is a date picker object for use in data entry. ClinPlus does not currently have one, so I thought I would create one.

The following object is a SAS AF frame that provides a selection of a date value that the user can choose using a calendar type interface. The selection of month, year and day are available. The object receives and returns a valid SAS date value. If no date value is passed, then the object defaults to today.

Setup

The object resides in the catalog file Calendar.sas7bcat and must reside in a library called Utility.

  1. Define a system library called Utility using the Source Administration module. This library needs to point to a folder that is available to all users with at least read access. This can be under the root directory of the system or in another location.
  2. Copy the catalog file Calendar.sas7bcat to that directory.
  3. It should now be callable from within the system.

Usage

To use the date picker from data entry, you will make a call to the module passing a numeric date field. This field can be a direct reference to the text attribute of a numeric date text field that is on a data entry screen.



When calling, first check the status of the target field by checking the LOCKED attribute so that a protected field is not updated by accident.


Code:
 

if upcase(visdate.locked)='NO' then
call display('utility.calendar.calendar.frame', visdate.text);
Example

This code can be called in different ways, but the easiest is to add a push button object using Add Item next to the field for that you wish to pick the date.

  • Open Screen Design module. Select your screen and go into Screen Layout.

  • Add a push button object next to the field that you want to pick the date.
    • You can rename the push button object if desired by right clicking and selecting NAME. Also, you can change the label displayed on the object by right clicking and selecting PROPERTIES – find the property LABEL and change the value as desired. I changed mine to ‘…’ You can also resize the object as needed.








  • Next, right click on the push button and select CODE. The editor will open up.




  • Add the call to the date picker object passing FIELDNAME.TEXT. In this example, my field is called VISDATE and is a numeric text field in my table that has an MMDDYY10. format and informat.




  • Close and save the code window.

  • Save the Screen Layout and go back to Screen Design.

  • Save the screen design.

  • Click Test and try the selection. It should now work.

Attached Files