Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how should i word this... and better...how should i do it?

how should i word this... and better...how should i do it?

Scheduled Pinned Locked Moved C#
databasehelpquestionworkspace
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jwalker343
    wrote on last edited by
    #1

    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?

    P realJSOPR 2 Replies Last reply
    0
    • J jwalker343

      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?

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      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.

      J 1 Reply Last reply
      0
      • J jwalker343

        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?

        realJSOPR Offline
        realJSOPR Offline
        realJSOP
        wrote on last edited by
        #3

        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

        J 1 Reply Last reply
        0
        • P PIEBALDconsult

          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.

          J Offline
          J Offline
          jwalker343
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • realJSOPR realJSOP

            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

            J Offline
            J Offline
            jwalker343
            wrote on last edited by
            #5

            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?

            realJSOPR 1 Reply Last reply
            0
            • J jwalker343

              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?

              realJSOPR Offline
              realJSOPR Offline
              realJSOP
              wrote on last edited by
              #6

              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

              D 1 Reply Last reply
              0
              • realJSOPR realJSOP

                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

                D Offline
                D Offline
                DaveyM69
                wrote on last edited by
                #7

                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)

                realJSOPR 1 Reply Last reply
                0
                • D DaveyM69

                  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)

                  realJSOPR Offline
                  realJSOPR Offline
                  realJSOP
                  wrote on last edited by
                  #8

                  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

                  J 1 Reply Last reply
                  0
                  • realJSOPR realJSOP

                    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

                    J Offline
                    J Offline
                    jwalker343
                    wrote on last edited by
                    #9

                    John 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.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups