Data Validation on ListOfObjects

Jason.Hicks made a good proposal of using ‘ListOfObjects’ as a base for development in the forum discussion ‘Reading a CSV file with test parameter combinations?’ When using ‘Developer’s System CE’ we would like to use the GUI for these ‘ListOfObjects’ parameters. But how do we make data validation on these parameters. It is not a problem to go true the list of object and return false if we find an invalid value, but do this ‘ListOfObjects’ GUI support to show data validation errors like it does for single value parameters?

The ‘ListOfObjects’ GUI with some bad exampledummy data:


Hi @tch11,

I believe that if your objects inherit ValidatingObject, you can use ValidationRules.

1 Like

I cannot figure out how to use the ValidatingObject in the ListOfObjects example. I tried to let the ‘Screw’ class inherit ValidatingObject, but then I get ValidatingObject’s properties in addition to the other Screw properties in the GUI !

Hello @tch11,

I implemented the ValidatingObject to one of my List of objects and didn’t have any issues, hope this helps as an example for you:

public class MarkerSpec: ValidatingObject
    [Display("Marker Frequency", Order: 1)]
    public double MarkerFrequency { get; set; }

    [Display("Lower Spec Limit", Order: 2)]
    public double lsl { get; set; }

    [Display("Upper Spec Limit", Order: 3)]
    public double usl { get; set; }

    public MarkerSpec()
        Rules.Add(() => usl > lsl, "USL must be greater than LSL", "usl", "lsl");
        Rules.Add(() => MarkerFrequency > 1e6, "Marker Frequency must be greater than 1 MHz", "MarkerFrequency");

Here is the GUI:

Let me know if this helps,

Carlos Montes


Perfect! It was easy when you know how to. Thanks.