How I can fetch data from a link type filter (When selected or changed) to an other filter?
See below image for example.
Reason to fetch data in another filter so that i can use it in html file for print purpose. Because i want to show student name in transcript report print.
Is there any other way to send variables to html file except filters and columns? I want to send more information when I print the report.
Please help.
One more thing, i am trying to use frappe.get_doc to get data, but when i use below code it is returning NULL
frappe.get_doc(":Student", "S1618016")
I have this student “S1618016” in students table
Zlash65
February 3, 2018, 12:40pm
3
frappe.get_doc("Student", "S1618016")
There shouldn’t be ‘:’ when specifying the DocType name
I tried without it too but not working
I copied the code from
<style>
.financial-statements-important td {
font-weight: bold;
}
.financial-statements-blank-row td {
height: 37px;
}
</style>
{% var letterhead= filters.letter_head || (frappe.get_doc(":Company", filters.company) && frappe.get_doc(":Company", filters.company).default_letter_head) || frappe.defaults.get_default("letter_head"); %}
{% if(letterhead) { %}
<div style="margin-bottom: 7px;" class="text-center">
{%= frappe.boot.letter_heads[letterhead].header %}
</div>
{% } %}
<h2 class="text-center">{%= __(report.report_name) %}</h2>
<h3 class="text-center">{%= filters.company %}</h3>
<h3 class="text-center">{%= filters.fiscal_year %}</h3>
<h5 class="text-center">{%= __("Currency") %} : {%= erpnext.get_currency(filters.company) %} </h4>
{% if (filters.from_date) { %}
here they are using frappe.get_doc(“:Company”, filters.company)
But for me with or without : its not working
Have a look at this file, might help you achieve what you want to do.
"default": "Cost Center",
"reqd": 1
},
{
"fieldname": "fiscal_year",
"label": __("Fiscal Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
"default": frappe.defaults.get_user_default("fiscal_year"),
"reqd": 1,
"on_change": function(query_report) {
var fiscal_year = query_report.get_values().fiscal_year;
if (!fiscal_year) {
return;
}
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
frappe.query_report_filters_by_name.from_date.set_input(fy.year_start_date);
frappe.query_report_filters_by_name.to_date.set_input(fy.year_end_date);
query_report.trigger_refresh();
});
1 Like
Have you tried get_query?
Assume S1618016, its fieldname is “name”
In student name Link Type filters.
“get_query”: function() {
var name = frappe.query_report_filters_by_name.name.get_value();
return {
“doctype”: “Student”,
“filters”: {
“name”: name,
}
}
}
Thanks this really helped