Interesting...

Ok, suppose on your schema design below:
Cond_id: integer
Cond_Field: Customer_field (From customer database)
Cond_operand: eq/ne/etc
Cond_Val:

You added another column:
Cond_id: integer
Cond_Field: Customer_field (From customer database)
Cond_operand: eq/ne/etc
Cond_Val:
Cond_Parent_id: integer

Where Cond_Parent_id is the id of the parent condition, then, this would give you the ability to have conditions of infinite nesting.

Ideally, you would then make the decision; should all the child conditions of a parent condition evaluate to true before a parent condition can be deemed truly true?

If yes, upto what depth?

I actually implemented sth similar, I was trying to have a Categories table where a category can belong to one parent category, thus, theoretically and practically, have unlimited depth of sub-categories, its actually worked but not without a lot of sweat, blood and recursion.



On Tue, Jul 17, 2012 at 1:35 PM, Bwana Lawi <mail2lawi@gmail.com> wrote:
Since you've done something similar please tell me if this approach is ok:

Funny enough the decision is either a yes/no (its to check if a customer qualifies for some products)

I am committing to db (no option of configs. Long story)

I am thinking of implemented it thus:

Cond_Field: Customer_field (From customer database)
Cond_operand: eq/ne/etc
Cond_Val:

So that a user can define conditions:

cond_1
Cond_Field: Region
Cond_operand: eq
Cond_Val: Nairobi

cond_2:
Cond_Field: Age
Cond_operand: <=
Cond_Val: 30

cond_3:
Cond_Field: Age
Cond_operand: >
Cond_Val: 30

cond_4:
Cond_Field: Salary
Cond_operand: <=
Cond_Val: 10000

etc

and then finally, set the decision that will be made out of these conditions set above. The system must be able to accept multiple conditions (combinations of which determine if the decision is Y/N)

Decision: y
Conditions: cond_1 and cond_4

Decision y (Another set of conditions for Y)
cond_3

Decison n

cond_1 and cond_2

I am yet to write a single line of code. Just trying to visualise the implementation

On Tue, Jul 17, 2012 at 11:10 AM, Peter Karunyu <pkarunyu@gmail.com> wrote:
My rule of thumb is:

1. If parameter is to be changed by techie people, put it in a config file
2. If parameter is to be changed by lay people, put it in a database table (usually a key-value store) and create a nice GUI for them to use to change the parameters

Has worked pretty well so far.

However, that takes care of where to store the contents of the variables of the condition, you still need to figure out how to actually implement the condition.


On Tue, Jul 17, 2012 at 1:00 PM, Bwana Lawi <mail2lawi@gmail.com> wrote:
Am in trouble. The problem is how to parameterise the conditions. Apparently the client wants them to be maintainable (added/removed at will). 


On Tue, Jul 17, 2012 at 10:31 AM, Peter Karunyu <pkarunyu@gmail.com> wrote:
At face value, I would guess there are (2 x 3 x 2 x 2 x 3 x 2)  possible scenarios, 144 in total :-)


On Tue, Jul 17, 2012 at 12:19 PM, Bwana Lawi <mail2lawi@gmail.com> wrote:
Couldnt come up with a good subject. 

I have to make a decision (well, my program has to) based on 6 variables. 

Var 1 has 2 options (boolean)
Var 2 has 3 
Var 3 has 2 (Boolean)
Var 4 has 2
Var 5 has 3
Var 6 has 2

How many possible scenarios am I looking at?

There are some interdependencies, of course, but for now ignore them. 

_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------

Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke


_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------

Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke


_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------

Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke

_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------

Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke


_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------

Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke



--
Regards,
Peter Karunyu
-------------------