Report template metadata



  • Hi!
    I need to store some additional info (Map<String, String> or dictionary) with each template and be able to query this info with along with the list of templates. Is it possible?



  • Hi,

    you can extend template type with custom string property inside a custom extension.
    Here are the docs for writing custom extension
    https://jsreport.net/learn/custom-extension

    or simply add just this to your server.js.

    const jsreport = require('jsreport')
    jsreport.use((reporter) => {
      reporter.documentStore.model.entityTypes['TemplateType'].foo = { type: 'Edm.String' }
    })
    jsreport.init()...
    


  • I want actually to have something like template.metadata = {
    customerId: "",
    label: ""
    };
    I need this to solve following usecase - We have set of default reports and many customers, some of them want reports to look differently. Having metadata, I will be able to store for example customerId, base report type it corresponds to, etc...



  • Yes, so why don't you add two, three... new props to the template?

    Or you can have one extra prop that serializes what ever you want. Like a map.



  • Sure, I can... I just thought that it can be a good base functionality :)



  • Yes perhaps. Thanks. Lets see if it gets requested more often.



  • I can relate to this, seems to be the exact same thing i need to do as well. I have to deploy the enterprise edition at each of my plethora of customers and this as base functionality would be greatly beneficial. Also I created an issue on Github before finding this post.
    https://github.com/jsreport/jsreport/issues/620



  • Can this actually just be done via the API and resources now?


  • administrators

    @Css-IanM thanks for creating an issue for this, let's move the conversation to the github issue, we will reply to the issue when we have analyzed the use case a bit more with the team


Log in to reply
 

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