Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TableObject Sum(Cell6) Not Working in Community Designer #47

Closed
githubfanster opened this issue Dec 10, 2018 · 7 comments
Closed

TableObject Sum(Cell6) Not Working in Community Designer #47

githubfanster opened this issue Dec 10, 2018 · 7 comments
Labels
question Further information is requested

Comments

@githubfanster
Copy link

I'm using the attached Csv file as Data Source for the attached productTable.frx Report Template.

when i preview the results in the Community Designer / Viewer, the Sum of all the values in the Price column is incorrectly showing as 0.

i'm building the report table dynamically, using the Table.frx example (my Script code is similar to that in Table.frx's Script Code).

What might I be doing incorrectly??

Thanks for helping!
CsvAsDataSourceTableObjectSumCellNotWorking.zip

@Detrav
Copy link
Member

Detrav commented Dec 10, 2018

Hi, in your report the data cell is Cell4, not Cell6, so you should use [Sum(Cell4)].

@Detrav Detrav added the question Further information is requested label Dec 10, 2018
@githubfanster
Copy link
Author

Thank you. That Worked.
How do I get the Table Header to get printed repeatedly for each new page?

In the designer, Table1 PrintOn property has RepeatedBand checked, in my SCriptCode,
i added:
// printing the table header

  Cell1.PrintOn = PrintOn.RepeatedBand; //added
  Cell2.PrintOn = PrintOn.RepeatedBand; //added
  Table1.PrintRow(0);
  Table1.PrintColumns();

Couldn't get it to work.

Thanks for helping!
HowToGetTableColumnHeadersToPrintRepeatedlyOnEachPage.zip
HowToGetTableColumnHeadersToPrintRepeatedlyOnEachPage.zip

@githubfanster
Copy link
Author

sorry didnt mean to close this issue yet.
i guess i dont understand what this means:

https://www.fast-report.com/en/forum/index.php?showtopic=11079

Tablecell have printon property. This may work.

TableCell tc
tc.PrintOn = PrintOn.RepeatedBand;

also band must have repeat on every page checked.

in my template, Table1.RepeatHeaders is set to true

@Detrav
Copy link
Member

Detrav commented Dec 10, 2018

The tc.PrintOn (Gets or sets a value that determines where to print the object.) property is not related to the repetition of the table header.

Use the following code:

table.RepeatHeaders = true;
table.FixedRows = 1; // for repeat only first row on every page

@githubfanster
Copy link
Author

thanks. that worked. now i may have a different problem.

in the last page, i get only the table header and table footer printed with no data in between because there's no more data.

so it looks like this:

Name Price
Total: 2345678.90

Can I do better than this? Just wondering :-)

Any conditional capabilities I could explore?

Thank you so much for helping a newbie!

@fediachov
Copy link
Contributor

fediachov commented Dec 10, 2018

Hi,

You can check the count of available rows and make the page brake from a code: table.PageBreak();
For example:

      int rowIndex = 0;
      while (rowData.HasMoreRows)
      {
        // print the table body  
        Table1.PrintRow(1);
        Table1.PrintColumns();        
        // check for table footer for last page
        if (rowData.RowCount - rowIndex < 3)
        {
          Table1.PageBreak();
          rowIndex = 0;
        }
        else
          rowIndex++;
        // go next data source row
        rowData.Next();        
      }

@githubfanster
Copy link
Author

thank you for the tip!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants