Car configurator sample - Dynamic constraints

Unanswered Car configurator sample - Dynamic constraints

  • Tuesday, July 03, 2012 4:22 PM
     
      Has Code

    Hi,

    I have added my own constraints in the car configuration sample below the following line of code

    car.AddConstraint("TableConstraint", Model.Equal(new Term[] { engine, carModel, package, price }, table));
    

    //newly added constraints

    car.AddConstraint("hope", "!(CarEngine == 'I4') | CarModel == 'performer'");

    I have not been able to get the constraint to work.

    I have been able to make numeric fields work but I have an issue with non numeric fields could anybody help ?

All Replies

  • Friday, July 06, 2012 2:45 AM
     
     

    I found a solution to this you need to keep the "  So this would be

    car.AddConstraint("hope", "!(CarEngine == 'I4') | CarModel == 'performer'");

    So this syntax worked instead

    car.AddConstraint("hope", "!(CarEngine == \"I4\") | CarModel == \"performer\"    "