locked
Filtering a Table based on multiple Columns. RRS feed

  • Question

  • How to achieve filtering condition like

    select * from Customers

    where State= 'TX' and City= 'Dallas'

    I went through samples in msdn like Static and Template based. but not sure how to filter a Table based on different filtering conditions on multiple columns.

    Thnaks

    Lavanya. 


    lavanyar
    Tuesday, November 2, 2010 2:52 AM

Answers

  • serverConfig.Tables["Customer"].FilterClause = "[side].[State] = 'Tx' AND [side].[City] = 'Retail'";

    • Marked as answer by Lavanyr Tuesday, November 2, 2010 4:40 AM
    • Unmarked as answer by Lavanyr Tuesday, November 2, 2010 4:40 AM
    • Marked as answer by Lavanyr Tuesday, November 2, 2010 4:40 AM
    • Unmarked as answer by Lavanyr Tuesday, November 2, 2010 4:40 AM
    • Marked as answer by Lavanyr Tuesday, November 2, 2010 4:41 AM
    Tuesday, November 2, 2010 4:38 AM

All replies

  • can you not call AddFilterColumn twice to add the filter columns and specify them both in a single filter clause? the filter clause is essentially a WHERE clause minus the WHERE keyword.
    Tuesday, November 2, 2010 3:08 AM
    1. serverConfig.Tables["Customer"].AddFilterColumn("State");  
    2. serverConfig.Tables["Customer"].FilterClause = "[side].[State] = 'Tx'";
    3. serverConfig.Tables["Customer"].AddFilterColumn("City"); 
    4. serverConfig.Tables["Customer"].FilterClause = "[side].[City] = 'Retail'";
    I already tried in the above way but in stored proc i am only seeing one where condition with state as only
    filtering condition.
    how to get AND , OR conditions?

    Thanks
    Lavanys


    lavanyar
    Tuesday, November 2, 2010 4:09 AM
  • serverConfig.Tables["Customer"].FilterClause = "[side].[State] = 'Tx' AND [side].[City] = 'Retail'";

    • Marked as answer by Lavanyr Tuesday, November 2, 2010 4:40 AM
    • Unmarked as answer by Lavanyr Tuesday, November 2, 2010 4:40 AM
    • Marked as answer by Lavanyr Tuesday, November 2, 2010 4:40 AM
    • Unmarked as answer by Lavanyr Tuesday, November 2, 2010 4:40 AM
    • Marked as answer by Lavanyr Tuesday, November 2, 2010 4:41 AM
    Tuesday, November 2, 2010 4:38 AM