Hiding or Making a Property Visible Following an Update to Another Property

This document provides information on how to use business logic to hide a property (field), or to make it visible, after the value of a different property has been updated.

In the process described below, we are adding a script to a representation class to hide property MYPROP2 when the value of property MYPROP1 is set.

  1. Open your representation class.
  2. In the Scripts block of the General tab:
    1. Select the appropriate type for your script in the Type field.
    2. Accept the default code displayed in the File field. It is automatically generated using the class code and the script type. You can also manually enter a unique code for your script.
    3. Accept the numeric value displayed in the Order field. It is automatically generated to control the order in which the $PROPERTIES and $METHODS labels are called in the event. You can also manually enter the running order code for your script.
  3. Click the Actions button of your script, and click Processing editor. Enter the source code below.
    $PROPERTIESCase CURPROWhen "MYCLASS.MYPROP1" : Gosub MYPROP1EndcaseReturn# Actions for "MYPROP1"$MYPROP1Case ACTIONWhen "PROPAGATE" : Gosub PROP1_PROPAGATEEndcaseReturn# Set MYPROP2 to hidden or visible, depending on value of MYPROP1$PROP1_PROPAGATEIf THIS.MYPROP1 = CST_AYESASTATUS = fmet THIS.ASETATTRIBUTE("MYPROP2","$isHidden","true")ElseASTATUS = fmet THIS.ASETATTRIBUTE("MYPROP2","$isHidden","false")EndifReturn
  4. Save your script.
  5. Save and validate your representation class.