Search Results for

    Show / Hide Table of Contents

    Computed attribute

    Like many storage solutions, Casewhere supports computed attributes. Instead of accepting values set by applications, Casewhere computes values from given expressions. Computed attributes are persisted in the database, so features like indexing and searching work as designed.

    Configuration

    In the data class editor, select an attribute and set Computed to True. It's possible to enable Computed for any data attribute.

    image-20220627165935480

    After turning on the Computed setting, you will need to provide a Computed Expression, which Casewhere will use to compute the value. The expression is a simple C# expression, accepting the keyword @do, which is used for accessing the data object attributes. Please note that you can only compute data from other existing data attributes.

    Example 1: Compute full name from first name and last name

    @do.FirstName + ", " + @do.LastName // "Jone, Doe"
    

    Example 2: Compute a friendly id from an auto-increment value

    @do.ApplicationNumber.ToString().PadLeft(5, '0') // "00018", "00019", ...
    

    Auto-increment attribute

    Auto-increment is a special computed attribute, which is applied for Integer and Long only. In the data class editor, select an Integer or Long attribute and set Auto Increment to True. When the setting is turned on, Casewhere will assign a new unique number when a new data object is created. The starting value is 1, and it will increment by 1 for each new data object.

    image-20220627174220752

    In This Article
    Back to top Generated by DocFX