If you want to use the for statement after filtering

Posted by: addio777 on 22 August 2018, 4:13 pm EST

    • Post Options:
    • Link

    Posted 22 August 2018, 4:13 pm EST

    Hi.

    If you use the for statement after filtering, the speed becomes slower.

    Is there a solution?

    Thanks.

  • Posted 23 August 2018, 6:00 pm EST

    Hello,

    How many rows are there after filtering? What operation are you performing on rows in ‘For’ loop?

    Could you please provide me more details about the issue you are facing? Or if you could provide a sample application to debug?

    Thanks,

    Deepak Sharma

  • Posted 28 August 2018, 12:13 pm EST

    Hi.

    I can not attach the file, I upload the source.

    Coloring the first column without filtering is fast.

    Coloring the first column after the filter slows down.

    Thanks.

    public partial class Form1 : Form

    {

    DataTable dt;

    public Form1()

    {

    InitializeComponent();

    }

        private void btnSet_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < fpSpread1.ActiveSheet.RowCount; i++)
            {
                string str = fpSpread1.ActiveSheet.Cells[i, 0].Value.ToString();
    
                if (str == "Bob")
                    fpSpread1.ActiveSheet.Cells[i, 0].BackColor = Color.DarkGray;
            }
        }
    
        private void btnCancel_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < fpSpread1.ActiveSheet.RowCount; i++)
            {
                fpSpread1.ActiveSheet.Cells[i, 0].BackColor = Color.White;
            }
        }
    
        private void btnFilter_Click(object sender, EventArgs e)
        {
            fpSpread1.ActiveSheet.Columns[fpSpread1.ActiveSheet.ActiveColumn.Index].AllowAutoFilter = !fpSpread1.ActiveSheet.Columns[fpSpread1.ActiveSheet.ActiveColumn.Index].AllowAutoFilter;
        }
    
        private void Form1_Load(object sender, EventArgs e)
        {
            dt = new DataTable();
    
            dt.Columns.Add("FirstName");
            dt.Columns.Add("LastName");
            for (int iCol = 0; iCol < 365; iCol++)
            {
                dt.Columns.Add(iCol.ToString());
            }
    
            for(int iRow = 0; iRow < 1000; iRow++)
            {
                DataRow dr = dt.NewRow();
    
                if(iRow % 2 == 0)
                {
                    dr["FirstName"] = "Bob";
                    dr["LastName"] = "Alice";
                }else
                {
                    dr["FirstName"] = "Jim";
                    dr["LastName"] = "Nancy";
                }
    
                for(int iCol = 0; iCol < 365; iCol++)
                {
                    dr[iCol.ToString()] = iCol;
                }
                dt.Rows.Add(dr);
            }
            fpSpread1.DataSource = dt;
    
            fpSpread1.ActiveSheet.AutoFilterMode = AutoFilterMode.EnhancedContextMenu;
        }
        
    }
    
  • Posted 29 August 2018, 12:23 am EST

    Hello,

    I am not able to replicate this issue at my when I tested it with Spread v11.0. Please test the attached sample application.

    After filtering with "Bob’ when I apply color , it takes no time to set the backcolor and works the same for removing the color.

    Thanks,

    Deepak SharmaSpreadWinFilterPerformance.zip

  • Posted 29 August 2018, 3:31 pm EST

    Hi.

    Thanks for the reply.

    I am using Spread v10.

    Spread v10 is still slow in sending sample.

    Thanks.

  • Posted 2 September 2018, 9:05 pm EST

    Hello,

    We are able to replicate the issue but it has been fixed in Spread Studio 11. Hence, we cannot post it as a bug and unfortunately, I couldn’t find a workaround as well for increasing its performance in Spread Studio 10.

    We regret the inconvenience.

    Thanks,

    Reeva

  • Posted 3 September 2018, 1:56 pm EST

    Hi.

    Thanks for the reply.

    After releasing the filter, I change it to logic processing and setting the filter again.

    Thanks.

  • Posted 3 September 2018, 2:36 pm EST

    Hello,

    We are glad to know that it has been resolved with a workaround.

    Thanks,

    Reeva

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels