GrapeCity Forums

The GrapeCity Message Boards
Welcome to GrapeCity Forums Sign in | Join | Help
in Search

Filtering with "and" criteria

Last post 02-19-2010, 8:08 AM by cyril64. 8 replies.
Sort Posts: Previous Next
  •  02-08-2010, 4:39 AM 87133

    Filtering with "and" criteria

    Hello,

    I would like to filter a spread with many filters (one per column) with an "and" criteria between these. Or today when i use a filter, the others are re-initializing automatically. Can I do that and if yes, How can i do ? Sorry for my english.

     I use this source code below to apply filters on my spread :

            FarPoint.Web.Spread.HideRowFilter hideRowFilter = new FarPoint.Web.Spread.HideRowFilter(FpSpread1.ActiveSheetView);
            hideRowFilter.ShowFilterIndicator = true;
            hideRowFilter.AddColumn(1);
            hideRowFilter.AddColumn(2);
            hideRowFilter.AddColumn(3);
            this.FpSpread1.ActiveSheetView.RowFilter = hideRowFilter;

     

     Thanks.
  •  02-08-2010, 3:08 PM 87156 in reply to 87133

    Re: Filtering with "and" criteria

    Hello,

    I am not sure with the line "and criteria between these" , however there are examples given in the Spread documentation to create a filter in Spread. Below snippet is from the Spread documentation:

     FpSpread1.Sheets[0].Cells[0, 2].Text = "test";

    FarPoint.Web.Spread.NamedStyle instyle = new FarPoint.Web.Spread.NamedStyle();

    FarPoint.Web.Spread.NamedStyle outstyle = new FarPoint.Web.Spread.NamedStyle();

    instyle.BackColor = Color.Yellow;

    outstyle.BackColor = Color.Aquamarine;

    FarPoint.Web.Spread.FilterColumnDefinition fcd = new FarPoint.Web.Spread.FilterColumnDefinition(1, FarPoint.Web.Spread.FilterListBehavior.SortByMostOccurrences | FarPoint.Web.Spread.FilterListBehavior.Default);
    FarPoint.Web.Spread.FilterColumnDefinition fcd1 = new FarPoint.Web.Spread.FilterColumnDefinition(2);
    FarPoint.Web.Spread.FilterColumnDefinition fcd2 = new FarPoint.Web.Spread.FilterColumnDefinition();
    FarPoint.Web.Spread.StyleRowFilter sf = new FarPoint.Web.Spread.StyleRowFilter(FpSpread1.Sheets[0], instyle, outstyle);
    sf.AddColumn(fcd);
    sf.AddColumn(fcd1);
    sf.AddColumn(fcd2);
    FpSpread1.Sheets[0].RowFilter = sf;
    FpSpread1.Sheets[0].AutoFilterColumn(2, "test");

    In the above snippet on fcd has been defined as a combination of 2 conditions. Similarly, you can also apply AND conditions on the Column


    Suresh Singh Dasila
    GrapeCity FarPoint
  •  02-09-2010, 4:09 AM 87169 in reply to 87156

    Re: Filtering with "and" criteria

    Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;} Hello Suresh,

    Thanks for the reply, but i have always the same problem. I need to add the filters (HideRowFilter type) with an "AND" conditions.

    For example, first, on the first column, I apply filter (selected in the combobox) and the spread is updated. Secondly, I apply a different filter on the second column, the spread is also updated BUT with the SUM of the two selected criteria (first and second column).

     Today, the data of my spread are reloaded each time I use a filter on a column...

    Thanks.

    Filed under:
  •  02-09-2010, 3:52 PM 87193 in reply to 87169

    Re: Filtering with "and" criteria

    Hello,

    I have discussed the issue with concerned team, could you please send us a zipped sample project to debug?

     


    Suresh Singh Dasila
    GrapeCity FarPoint
  •  02-17-2010, 9:07 AM 87389 in reply to 87193

    Re: Filtering with "and" criteria

    Hello Suresh,

     I work on a big project and it's complicated to extract a part of it which will work correctly. I have a spread feed by a database and on server side I run the code below :


            FarPoint.Web.Spread.HideRowFilter hideRowFilter = new FarPoint.Web.Spread.HideRowFilter(FpSpread1.ActiveSheetView);
            hideRowFilter.ShowFilterIndicator = true;
            hideRowFilter.AddColumn(2);
            hideRowFilter.AddColumn(4);
            hideRowFilter.AddColumn(6);
            hideRowFilter.AddColumn(8);
            this.FpSpread1.ActiveSheetView.RowFilter = hideRowFilter;

    These filters work correctly one by one but I need to cumulate them ("and criteria"). If I use the first filter ( on name for example) with "JACKSON" item and the second filter (on given name for example) with "John" item : I want to display on my spread whole of lines which match with name = "JACKSON" AND given name = "John".

    Thanks

  •  02-17-2010, 12:12 PM 87394 in reply to 87389

    Re: Filtering with "and" criteria

    Attachment: Filter1.rar

    Cyril,

    I am sorry we are still not clear with the requirement of AND criteria. Do you want to have the Jackson & Jon as filtered items of a single ROW ? I am attaching a simple sample  project, can you please elaborate your requirement with that sample.I have removed the BIN folder from this to adjust the attachment size requirement. Also there is filtering sample in the spWebProductTour sample project, you may refer that as well.


    Suresh Singh Dasila
    GrapeCity FarPoint
  •  02-18-2010, 5:19 AM 87416 in reply to 87394

    Re: Filtering with "and" criteria

    Attachment: Filters.rar

    Hi Suresh,

    Thank you for your help. I can't explain to you my issue with the project you send me because each column is composed by different value so the filter return necessarily one row and it's not what I want.

    But I am attaching a simple Excel file which explains how I want to use the filters. Hoping you can resolve my issue.

    Thanks .

  •  02-19-2010, 4:40 AM 87446 in reply to 87416

    Re: Filtering with "and" criteria

    Attachment: Filter1.rar

    Cyril,

    Take a look at this modified sample project and let us know if that achieves the desired behavior.


    Suresh Singh Dasila
    GrapeCity FarPoint
  •  02-19-2010, 8:08 AM 87454 in reply to 87446

    Re: Filtering with "and" criteria

    Hi Suresh,

    It's perfect !! I have the same source code but I wrote it in a bad place. I understood my error when I saw your code.

    Thanks for your answer and your patience !!

    Best regards.

    Cyril.

View as RSS news feed in XML
     FarPoint Forums Home