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


  • administrators

    @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. :)





  • 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/1660996

    More 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 get

    LocalReporting() - the type or namespace name 'LocalReporting' could not be found.

    0_1502191040943_upload-663c061d-8dc2-46b8-b0bf-7eb2a9b02f90

    below are the usings
    0_1502191292512_upload-7dc7bdcb-e8bd-4c4f-b89e-704556ce585e

    Jsreport.Local doesn't have the def for LocalReporting()
    0_1502191426570_upload-3b21cefc-ac73-41d4-9950-2feeb130b878



  • You didn't install preview package of the jsreport.Local.





  • 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.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.