Template on the fly
-
Hi, I have the same requirement. I would like to customize my reports by selecting fields to report on.
As it supports handlebars, I Guess it would be matter of configure the template .... something line the conditional example below .. right?
https://jsreport.net/learn/handlebars
-
@Labretto in order to help you with that error, can you setup a github repository with the code that you are trying and share it here? maybe it is just something configured wrong, i'm not a C# expert but the repository can help me or @jan_blaha to see the problem.
-
@ollivera2000 I think it could be the one of the ways to accomplish our customization. The customization I'm looking to build is something as below --
Section A - Metadata about a school
Section B - data table about past programs
Section C - data table about programs running currently
Section D - data table about future programs
Section E - Progress so far
Section F - Feedback
Section G - Roadmap
Section H - ...
etc..User when requesting for a report would pick from these sections (any combination - say A,B,C,D & H). Now within these sections, we have data tables which may have many data fields ( here, we want to allow them to choose which data fields to show in the report under appropriate sections too), thus providing flexibility, yet retaining a robust reporting feature ;)
Any ideas on how to go about it, are much appreciated :)
-
@bjrmatos yes, I too sense that it could be some configurations done incorrectly. I will share the repo here, once I have it uploaded.
Thank you. :)
-
@bjrmatos here is the link - https://github.com/Labretto/jsreporters/tree/e20f026d24fadb2288bc3f47012a1b3817083830
-
You have full power with templating engine like handlebars to achieve your required layout. It is only about learning a bit of handlebars and do some coding.
Your example repository needs to differently handle async task in void method. It is the same as handling async task in the console
Main
.
https://stackoverflow.com/a/24601591/1660996More precisely change this
protected void Button1_Click(object sender, EventArgs e) { Task.Run(GenerateJsReportAsync).GetAwaiter().GetResult(); }
You could also take a look on the preview of the next jsreport .NET sdk release. It could be easier for you attach jsreport into web forms app using jsreport.Local package then with the jsreport.Embedded.
https://jsreport.net/learn/dotnet-v2
https://jsreport.net/learn/dotnet-local
-
@jan_blaha : Thank you. However I ran into the below after making the suggested change.
An exception of type 'System.AggregateException' occurred in mscorlib.dll but was not handled in user code
Additional information: One or more errors occurred.On Preview packages, I installed jsreport.Local and jsreport.Binary into the project.
On this line of code
var rs = new LocalReporting().UseBinary(JsReportBinary.GetBinary()).AsUtility().Create();
I getLocalReporting() - the type or namespace name 'LocalReporting' could not be found.
below are the usings
Jsreport.Local doesn't have the def for LocalReporting()
-
You didn't install preview package of the
jsreport.Local
.
-
Make sure you have this one https://www.nuget.org/packages/jsreport.Local/1.0.0-beta2
-
Oops! my bad, I hadn't check marked to include pre-release versions when I was searching for it in NPM. Thank you for the quick reply. I'll play around with it a bit and get back.