Story: How to make nice report - HiStructClient/femcad-doc GitHub Wiki
FemCad is extremely powerfull in generating various reports. The following procedure tells you how to get good looking output to the customer.
1. Collect data
There are many data in the model already, the first you need to do when preparing nice output report is to collect them. For detailed description view this page (and don't forget to return back here).
2. Make a document
The concept of making a document chapters, tables, pictures and texts is quite straightforward. You can read this page to know more.
3. View the output
When the document is ready you can browse it in FemCad (or VS Code with FemCad extension). The keyword is browse report
browse_report Document1
The report is opened in default html browser on your computer. If you want to be sure that such report looks good on A4 page (which is supposed to be the most obvious page format) try to export it from the browser to PDF file, or generate print preview, for example.
On HiStruct, the key to show the report is action button that generates also the html document (on separate browser tab). Below is an example of the button definition function, where the function name, description, human name and document naming is required:
ReportExportClassFn := vn, des, hn, img => res.fit.InputItemAction{
NameSpace := NameSpace + vn + ".",
Description := des,
HmtlContent := hn,
CssStyleClass := "fcs-parameterItem-inMenuButton",
IsReadOnly := True,
EditabilityCondition := False,
ActionName := img,
NavigationUrl := "Projects/Report?id=##componentId##&reportName="+ img}
Note: such a piece of code creates desired button on the output page, however it does not mean that the report is displayed. There are a few more steps to go. Read next chapter.
4. Make it work!
There is a need to register all reports in a separate fcscdx file. Sample content of this file follows:
{
"Reports": [
{
"Name": "BomPrimary",
"HumanName": "Primary structure BOM",
"Description": "Primary structure BOM",
"ReportType": "Fcs.Reporting.Document.Html",
"Identifier": "building.outputs.BomPrimary"
},
{
"Name": "BomSecondaryOverall",
"HumanName": "Secondary structure BOM",
"Description": "Secondary structure BOM",
"ReportType": "Fcs.Reporting.Document.Html",
"Identifier": "building.outputs.BomSecondaryOverall"
},
]
}
Also, this Reports.fcscdx needs to be registered in fcscdm file. Such file for Building configurator (for example) is located in the following folder: BuildingRectangular.fcc/Buildingrectangular.fcscdm
This file has to have this line:
"ReportsFile": "..\\HiStruct_BuildingConfigurator\\General\\Reports.fcscdx",
Note:
If you want to share particular report with someone outside of FemCad-comunity, there is a nice feature how to have a link that shows the report. Read dedicated page.