Skip to main content

Basing One Generated Property on Another

Basing One Generated Property on Another

In some cases, the set of suitable value for one property (A) might depend upon the existing value of another property (B). In such a case:

  • Create an instance method to generate values for property A. In this method, use instance variables to obtain the value of property B (and any other properties that should be considered). For example:

    Method MyMethod() As %String
    {
        if (i%MyBooleanProperty) {
            quit "abc"
        } else {
            quit "def"
        }
    }

    For more information on instance variables, see i%PropertyName.

    Use this method in the POPSPEC parameter of the applicable property. See Specifying the POPSPEC Parameter.

  • Specify the POPORDER parameter of any properties that must be populated in a specific order. This parameter should equal an integer. InterSystems IRIS populates properties with lower values of POPORDER before properties with higher values of POPORDER. For example:

    Property Name As %String(POPORDER = 2, POPSPEC = ".MyNameMethod()");
    
    Property Gender As %String(POPORDER = 1, VALUELIST = ",1,2"); 
    
FeedbackOpens in a new tab