Hi.
You can now set Automatic
in parameters of type Is doctype id
. You can also put in the field Field Doctype Value
or in the box Parameter Value
the name of the field that you want to use as the value for this parameter. In this way it is not limit to the id/name
of doctype.
As an example, putting the Parameter Value
box as System Settings:language
you can, inside Administrator of doctype User, call the following function:
jasper.get_jasper_report({jr_name: "Cherry Local", jr_format: "pdf"})
It will generate the report Cherry Local
in pdf with parameter that you choose for type Is doctype id
with the value of the field that you put in Parameter Value` box, in this case with the value of language of the system.
If you want the parameter of type Is doctype id
as the field of the doctype where you generate a report (User in this example) then you just need to set the value Field Doctype Value
to the name of the User field that you want. As an example you can set the value Field Doctype Value
to first_name
, the field of doctype User
.
You can also pass parameter of type Is doctype id
in params argument of jasper.get_jasper_report
function, like this, any where call:
jasper.get_jasper_report({jr_name: "Cherry Local", jr_format: "pdf", doctype_type:"Form", params: {language: "System Settings:language"}, doctype:"User", docids:["luisfmfernandes@gmail.com"]})
OR, if inside form User/Administrator just call:
jasper.get_jasper_report({jr_name: "Cherry Local", jr_format: "pdf", params: {language: "System Settings:language"}})
The format of Parameter Value
box can be: doctype:fieldname
or doctype:docname:fieldname
or fieldname
.
NOTE: when you use field Field Doctype Value
do not use box Parameter Value
and the other way around. But if you do then the values passed in jasper.get_jasper_report
take precedence to the others then Parameter Value
and then Field Doctype Value
.
Also, if you do not pass to jasper.get_jasper_report({jr_name: "Cherry Local"})
jr_format
it default to pdf.
Let me know if this work for you or you find any error.