TestReport.fdf (3.4 MB)
Hi Jean,
Please import the attached FDF to help demonstrate what you are trying to achieve. You will need to do a bit of editing, so what I have done in the sample FDF is have two reports, the Stock Report Demo record is in its original state generated from the wizard and the Stock Report record is the edited version so you can compare them both.
The Sum function in the Report Wizard is only designed to sum up the total records, it has not been implemented to work in a Group By in the wizard. I will bring it up in our next product review meeting that we should add some more helper functions.
You have also brought to our attention that the records are not coming through for the Group By, it is returning the column header in the template, I will get this looked into.
As a solution for you, you can add the basics of your report in the wizard, add a custom function and edit the report template to end up with a result like below:
- Start by adding your report in the wizard with the group by, not the sum.
- Once your report has been saved, head to the Reports view and select the record, on the General page you will see a field called Code. Click in this field and you can add custom code that can be used in your report, this code editor acts as a library so you can add multiple code blocks here. These code blocks are in the attached FDF.
The GetTotalStockCountByCategory() will calculate the total stock count for the category in the group.
The GetTotalStockValueByCategory() will calculate the total value in stock for the category in the group.
- Save your functions, you can completely save your report record here if you want and edit it again or just click straight in the Template field on the General page. The template has been generated from the wizard and you can edit it here. The below image shows the original template generated by the wizard.
- This is what I edited:
a. Bold and centred the header, use the ribbon across the top.
b. On line three under the header, delete the Group By Header (as this is just the holder for what you want to call the group. Then bold Category (keep curly braces around Category).
c. Insert a horizontal line using the tool in the ribbon.
d. In the each block under the category header, delete {{category}} (this is the issue I mentioned earlier). Insert a table from the ribbon with how ever many columns you require and manually enter your fields (field IDs) wrapped in double curly braces. (I right aligned the last field.)
e. Delete the following: Group By Footer {{Category}}, Group By Final Product, delete the tables at the bottom.
f. Then add the following before the last ending of {{/_Each}} and {{_GroupBy}}
Total stock count: {{GetTotalStockCountByCategory Category @root.[Product].[Records]}}
Total stock value: ${{GetTotalStockValueByCategory Category @root.[Product].[Records]}}
Note 1: you can format them with underlines, bold etc using the ribbon.
Note 2: You will not need to manually add your functions into the template like this in the future as we are improving our Insert Fields section in the ribbon.
In case you didn’t already know there is a Change Mode tool in the top left of the ribbon (just hover on the tools to see their icons) if you know HTML and CSS, you can also use this side.
Let me know if you need any more images or something doesn’t work so we can get your report how you want it!
Kind regards,
Jo