No announcement yet.

Derived Fields

  • Filter
  • Time
  • Show
Clear All
new posts

  • Derived Fields

    From: Murray, Joe
    Sent: Friday, February 09, 2007 4:18 PM
    To: Greg Wagner
    Subject: Question for Derived Data Fields

    Hi Greg,

    Thanks for taking the time to talk with us about the derived fields issue. Here is a summary of how we would like the data to ultimately appear in the dataset:

    We created variables of SUBJID, USUBJID and VISITNUM at the data structure level, but these are not present on the data entry screens. We want the ClinPlus default variables of INVESTIGATORNUMBER (i.e., 801) and PATIENTNUMBER (i.e., 001) to be concatenated into our variable SUBJID (i.e. 801-001).

    Also, we need our variable USUBJID to be populated with a 3 digit study code, in addition to investigator and patient numbers (i.e. 008-801-001).

    Also, we need our own numeric variable of VISITNUM to be populated with the same value as the default character variable VISITNUMBER. So the data would appear as:

    INVESTIGATOR NUMBER = 801 PATIENT NUMBER = 001 SUBJID = 801-001 USUBJID = 008-801-001 VISITNUMBER = 1 (character) VISITNUM = 1 (numeric)



    From: Greg Wagner
    Sent: Monday, February 12, 2007 6:02 PM
    To: Murray, Joe
    Subject: Question for Derived Data Fields

    Hi Joe,

    To accomplish what you are trying to do, you could either add code directly to the onLoad() method of the screen or in a macro. Since the same action needs to be applied to many screens, it is best to use the macro approach. I am attaching the macro I used to accomplish this. This can be stored in either a Global, Source or Study level macro library. Basically, by using a macro, all you would need to do is add the fields to your screens, set some properties and add the macro call - %sclSetFields;

    Here is how you would set this up.
    • Place the file in a macro library
    • Make sure the required fields (SUBJID, USUBJID and VISITNUM) exist on the data structures.
    • Add the fields to your screen definition and Text field objects to the screen layout.
    • Set the properties for each of the derived fields as follows
    • Protected=’Yes’
    • Validate=’No’
  • Open the screens onLoad() method entry and add the following code
    ** Call macro to set derived fields **;
  • Save the code
  • Save the screen

Some notes about this procedure:

I am using the study description from the environment as the first part of the USUBJID value. If this is not the appropriate value, we will need to change this.
You can change the name of the macro if you like – you would need to change the following and they would all need to be the same
  • Macro program name
  • Macro name in program code
  • Name used in onLoad() to call the macro

Please let me know if you need to go over any of this – I would be happy to set up a WebEx session with you to show you.

Best regards,


Attached are some screen shots of the setup and the macro.
Attached Files