DataView filter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Duggi

    DataView filter

    Hi

    I have a dataview. I would like to apply a filter on the dataview on a
    column with datatype system.string. I have filter with wild char *.

    >>Operator LIKE is used to include only values that match a pattern with wildcards. Wildcard character is * or >>%, it can be at the beginning of a pattern '*value', at the end 'value*', or at both '*value*'. Wildcard in the >>>>middle of a patern 'va*lue' is not allowed.


    I need to support wild chars * and ? in the filter expression
    anywhere? How do I work around it.

    Please help me to solve the same.

    Thanks in advance


    -Cnu

  • Jani Järvinen [MVP]

    #2
    Re: DataView filter

    Hello Cnu,
    I have a dataview. I need to support wild chars * and ? in the filter
    expression
    anywhere? How do I work around it.
    As you have already noticed, the basic filtering the DataView class supports
    is useful, but only takes you so long. Thus, if you need to support further
    filtering, you need to write the code yourself.

    Depending on your needs, you might wish to look through the rows in the
    DataView, check if the field values match, and then do something with the
    rows. You could use regular expressions to help with the pattern matching.

    Another option would be to use LINQ to DataSet to do parts of the filtering.
    I'm also sure there's already ready-made code to do the matching you need
    (as it appears to match DOS wildcard matching), so do a search on the 'net.

    Good luck!

    --
    Regards,

    Mr. Jani Järvinen
    C# MVP
    Vantaa, Finland
    janij@removethi s.dystopia.fi



    Comment

    • Duggi

      #3
      Re: DataView filter

      On Nov 11, 9:23 am, "Jani Järvinen [MVP]"
      <ja...@removeth is.dystopia.fiw rote:
      Hello Cnu,
      >
      I have a dataview. I need to support wild chars * and ? in the filter
      expression
      anywhere? How do I work around it.
      >
      As you have already noticed, the basic filtering the DataView class supports
      is useful, but only takes you so long. Thus, if you need to support further
      filtering, you need to write the code yourself.
      >
      Depending on your needs, you might wish to look through the rows in the
      DataView, check if the field values match, and then do something with the
      rows. You could use regular expressions to help with the pattern matching..
      >
      Another option would be to use LINQ to DataSet to do parts of the filtering.
      I'm also sure there's already ready-made code to do the matching you need
      (as it appears to match DOS wildcard matching), so do a search on the 'net.
      >
      Good luck!
      >
      --
      Regards,
      >
      Mr. Jani Järvinen
      C# MVP
      Vantaa, Finland
      ja...@removethi s.dystopia.fiht tp://www.saunalahti. fi/janij/
      Thanks. I think I need to write custom filter. However, I still did
      not find how to support ? as a wild char

      -Cnu

      Comment

      Working...