المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : how should i word this... and better...how should i do it?



C# Programming
01-19-2011, 07:51 PM
ok,

so here is what i am trying to accomplish, and i've had some "OK" ideas, but none seem to fit the bill exactly...

Program Logic:
i have a file, that will be read and parsed into a datatable
(this is at runtime, columns are unknown & generated as the file as parsed... the number of columns can change..)

then in my application, a certain set of criteria will be applied to that file, if col1 = "asdf", if col2 = "blue"

if all the conditions are met, the file is moved to dir A, if the conditions are not met, the file is moved to dir B.




Problem:
the problem comes when the criteria are applied, basically i want the end user to be able to create their own criteria for the file, the end user will not know SQL so i was thinking some kind of graphical representation of the WHERE clause....

there are a couple of problems i've ran into:

how would the user specify AND/OR to multiple conditions: (they can have infinite #)
(graphically represented:
IF col1 = "BLUE" AND
IF col2 = "Green" OR
IF col3 = "yellow"

could render 2 sets SQL Where clauses:
1. WHERE ((col1='blue' AND col2='green') OR col3='yellow')
2. WHERE (col1='blue' AND (col2='green' OR col3='yellow')
my solution for this problem was to setup AND/OR condition groups:
Graphically represented:
IF all of the following are true
(
col1='blue'
col2='green'
)
OR
IF all of the following are true
(
col3='yellow'
)
this is easy to represent graphically, but i can't find a good solution for storing it long term in the database...
i'd rather not have to write an entire application to generate/parse SQL into this format
does anyone have any ideas? / are the some code snippets available that do something similar?