Link to home
Start Free TrialLog in
Avatar of sakthikumar
sakthikumar

asked on

Need help on decision table structure

I want to create a table by which we should be able to implement complex business rules.

simple eg:

(test1 = pass or (test2 = fail and test3 = pass))
or (test4 = fail or test5 = pass)

test1,test2,test ... test5 are columns in a table.
pass and fail are values.

what should be the table structure to implement these rules?
Avatar of Sean Stuber
Sean Stuber

not enough information yet.

Does every rule consist of the same 5 tests?  if so, all 5 should be distinct columns in a single table.
You might want to consider this structure even if some rules might be missing a couple and simply null them.
(rule_id, test1, test2,test3,test4,test5)


Could each rule have a varying number of tests, possibly even more than 5, and the which types of tests can vary as well?
If so test types should be a separate table and each rule should have one or more rows that join to the test table.

(test_id,  test_description)
(rule_id, test_id, test_result)
Avatar of sakthikumar

ASKER

I have a table with columns test1 to test5 and more columns.
rule could be based on any one of these columns.

Also in the rule table, there should be a column to store operator(">","<" ...)

I am just confused like how to handle nested conditions
If there are Parent conditions / child conditions like multiple "OR" and "AND". In this case,  what should be the procedure
for this rule
I'm not sure I understand.

I think you might just want a large text column (like varchar2(4000))  to hold the text of your rule
Then you could simply evalute it with substitution
I'm sorry I didn't explain you clearly. I am creating a front end application in apex for creating rules.
I will be having an option to select the column name (from table. this could be test1 or test2 or any column)
                                          then to choose operator (> < = etc.,)
                                          then to choose value ('pass','fail' ...)
what should be the table design to build rule like below.

(test1 = pass or (test2 = fail and test3 = pass))
or (test4 = fail or test5 = pass)
ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This I can do, but users may not be able to write condition.

if there is something like dropdown available for rule creation, it will be easy for them.

and If I know in which table structure I can store this rule, I can design a front end for them.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial