Remove rows from a table after a manual build

Hi, i've the following problem:
i'm using ManualBuild event to build a table. I need to use the manual build because i need to revert rows with columns. After i've built the table (using PrintColumn and PrintRows), i'd like to remove some rows (in particular i need to remove rows that have all zeros as value). Is there a way to manipulate table after manual build? I've tried using before print event, removing a row from the table, but it had no effect. I've even tried manipulating the datatable at the beginning of manualbuild event, removing some columns but during the table building an exception is raised. Is there a way?
Thank you

Comments

  • GabrieleGabriele Florence, Italy
    edited March 2012
    capedica wrote: »
    Hi, i've the following problem:
    i'm using ManualBuild event to build a table. I need to use the manual build because i need to revert rows with columns. After i've built the table (using PrintColumn and PrintRows), i'd like to remove some rows (in particular i need to remove rows that have all zeros as value). Is there a way to manipulate table after manual build? I've tried using before print event, removing a row from the table, but it had no effect. I've even tried manipulating the datatable at the beginning of manualbuild event, removing some columns but during the table building an exception is raised. Is there a way?
    Thank you

    Hi, me too I have the same problem, i don't know how hide rows after the manualbuild. If I try to use the

    MyTable.RowCount

    or

    MyTable.ColumnCount

    I have like result the numbers of cols or rows of the base table I have add on a report but I don't know how gain the access to the rows / cols of rendered table.

    Best regards,

    Gabriele
  • edited 3:49AM
    Hello,

    Here is some reports that demonstrate how to manipulate the TableResult data. Run it from Demo.exe.
  • edited 3:49AM
    Ok, thank you, i will try with a matrix. Maybe the ModifyResult event could be usefull for the table object too?
    AlexTZ wrote: »
    Hello,

    Here is some reports that demonstrate how to manipulate the TableResult data. Run it from Demo.exe.
  • edited 3:49AM
    The Matrix uses the same rendering procedure. So you can use this with Table object too.
  • GabrieleGabriele Florence, Italy
    edited 3:49AM
    Thank you all for quick support! I try to modify my reports!
    Best regards

    Gabriele
  • GabrieleGabriele Florence, Italy
    edited March 2012
    Thank you all for the support, here the final example with his code, MyBaseTable is the table object in FastReport Designer:
          TableResult table = MyBaseTable.ResultTable;
          for (int r=table.FixedRows; r < table.RowCount -1; r++)
            {
                bool bRowEmpty = false;   
                for (int c=table.FixedColumns; c < table.ColumnCount; c++)
                {
                    if (table[c,r].Value != null && table[c,r].Value != DBNull.Value)
                    {
                        if ((table[c,r].Value) is string)
                        {
                          if (!String.IsNullOrEmpty((table[c,r].Value).ToString()))
                          {
                            bRowEmpty = true;
                            break;
                          }
                        }
                        else
                        {
                          if (Convert.ToDouble(table[c,r].Value) != 0)
                          {
                            bRowEmpty = true;
                            break;
                          }
                        }
                    }
                }
                if (bRowEmpty == false)
                {
                  table.Rows[r].Height = 0;
                }
            }
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.