views:

62

answers:

1

Hello. I write code in isolation, that is I work for myself. I need some advice on how you might implement the following functionality or if there are some tools that already exist to help make this task easier to accomplish.

I have a scenario (C# application) in which I would like the user to be able to enter conditional rules which will then be used elsewhere in the program for various calculations.

As a simple example let's say we have a TimeRequiredForJob property and we need to calculate this in the program based upon the users rules. A simple rule might be

TimeRequiredForJob = 200 Balloons multiplied by 5 min each, or TimeRequiredForJob = 20% of HoursInAfternoon

I am guessing its pretty hard to see what I am looking for so maybe the following image will help: DevExpress XtraGrid Filter Example

This is from DevExpress XtraGrid and it allows a user to filter data displayed in the grid based upon the users custom filter rules. I would like to implement something similar but be able to save the rules to a database and use those rules later in the application.

Any suggestions or tips welcome.

[Late Edit]

Actually I am getting some good information from this question but any additional information will be appreciated.

+1  A: 

Forgetting about the GUI for a second, you will need to first need to build some kind of rule evaluation processor.

You may find this article on building an Evaluation Engine helpful. It describes processing text expressions into a form that can be evaluated.

Once you have a way of representing these rules (either as an object structure or as text expressions) the task of building a GUI to suit your specific requirements will become easier.

Simon P Stevens
Wow, great article and looks like some good (required) reading. I'll make myself a cup of coffee and have a look now. Thanks!
Macondo
Simon, thanks again. The Expression Engine you pointed me to should work for my application. Exactly what I was looking for.
Macondo
@Macondo: No problem, glad it helped, although if you want to thank the author there is a comments box at the bottom of the article.
Simon P Stevens