How to use frappe.db in jinja template in report print format html file

we can use frappe.db.get_value in normal jinja print format of document but i am not able to use the same syntax in html of report. is there any way to achieve similar result.

@nishith it’s not a jinja! It’s something that sounds like jinja, but is not jinja!

It’s a javascript templated renderized in the front-end site in many cases!

You can use instead of frappe.db.get_value

Ok Thank You @max_morais_dmm :slight_smile:
Can you please give me one example how to use in that html…?


Please check the task_info.html for example. Although it is used in Page instead of Report.


Thanks for the response @makarand_b , but I don’t want to use it in jinja. It’s general_ledger.html file which is look like jinja but not jinja.

As @max_morais_dmm said,
It’s not jinja, it is a js template.
You can use them as

frappe.db.get_value(doctype, docname, fieldname, function(value) {
  frappe.render_template('template_name', { value: value });

I have already used this but it shows that get_value is undefined i.e that function is not accessible in general_ledger.html file. Is there any way to include that function in this file.?

nope, you can’t do async calls in templates

Can jinja be used for report print formats ?

Yes, at least now two years later the docs state that’s the case -

“Frappe allows you to create custom Print Formats for your Query and Script Reports.”

Read on

However since reports are generated on the server, perhaps that means only serve-side Jinja and not JS is the only option here?

I’m currently working on a script report with a custom template. Could someone please guide me on how to properly set up this template in frappe.templates?