how should i word this... and better...how should i do it?
-
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:
- WHERE ((col1='blue' AND col2='green') OR col3='yellow')
- 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?
-
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:
- WHERE ((col1='blue' AND col2='green') OR col3='yellow')
- 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?
I'm not sure of all you're proposing, but I never allow data from a file to be loaded into a database simply based on the sender's say-so. I've been asked to implement such things more than once. Don't give out information willy-nilly -- the sender shouldn't know the names of the columns in the table, nor even what database system you use. I very much prefer to have a method of validation and mapping under my own care that directs the file import process.
-
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:
- WHERE ((col1='blue' AND col2='green') OR col3='yellow')
- 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?
You need to develop what's called an ad-hoc query interface. I'd probably create a form that contained the following controls in a row: Label (with column name) ComboBox (allows the user to select an operator, like <, = >, etc - "=" is the default selection) TextBox (allows the user to specify the value used in the expression) ComboBox (allows the user to specify END, AND or OR - END is the default selection) If the user selected AND or OR in the last combobox, add another row of controls to the form. When the user indicates that he's done specifying parameters, create a LINQ query that conforms to the specified parameters.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997 -
I'm not sure of all you're proposing, but I never allow data from a file to be loaded into a database simply based on the sender's say-so. I've been asked to implement such things more than once. Don't give out information willy-nilly -- the sender shouldn't know the names of the columns in the table, nor even what database system you use. I very much prefer to have a method of validation and mapping under my own care that directs the file import process.
in a standard database-type system this is true, however the entire point of the application is moving files from one folder to either of two ending folders, so the datatable i mentioned is just a temporary one.
-
You need to develop what's called an ad-hoc query interface. I'd probably create a form that contained the following controls in a row: Label (with column name) ComboBox (allows the user to select an operator, like <, = >, etc - "=" is the default selection) TextBox (allows the user to specify the value used in the expression) ComboBox (allows the user to specify END, AND or OR - END is the default selection) If the user selected AND or OR in the last combobox, add another row of controls to the form. When the user indicates that he's done specifying parameters, create a LINQ query that conforms to the specified parameters.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997ah, i knew it must have a name!! that makes sense, and i have come to that conclusion, but i want to make it very advanced, and allow the user to have the ability for nested AND/OR clauses to produce SQL like this: WHERE (col1 = "a" OR ((col2="b" or col3 = "c") AND (col4="d")) is there an example of an ad-hoc query engine on codeproject, that i could look at?
-
ah, i knew it must have a name!! that makes sense, and i have come to that conclusion, but i want to make it very advanced, and allow the user to have the ability for nested AND/OR clauses to produce SQL like this: WHERE (col1 = "a" OR ((col2="b" or col3 = "c") AND (col4="d")) is there an example of an ad-hoc query engine on codeproject, that i could look at?
Do you have the ability to type "google.com" in your browser's address bar?
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997 -
Do you have the ability to type "google.com" in your browser's address bar?
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997In my opinion, a better answer would be... No I don't, but I'm sure a Google search will yield some useful results. Says the same thing but without the unnecessary rudeness :thumbsup:
Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) -
In my opinion, a better answer would be... No I don't, but I'm sure a Google search will yield some useful results. Says the same thing but without the unnecessary rudeness :thumbsup:
Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Of course, you're assuming I wanted to avoid being rude, or that I wasn't matter-of-factly posing a reasonable question.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997 -
Of course, you're assuming I wanted to avoid being rude, or that I wasn't matter-of-factly posing a reasonable question.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997John Simmons / outlaw programmer wrote:
Of course, you're assuming I wanted to avoid being rude, or that I wasn't matter-of-factly posing a reasonable question
you don't think i have searched google?, i actualy assumed that the user answering the thread would have some more in depth knowledge other than "this is what its called..." there is no need to be rude, that only gives yourself a bad name.