VINOTH
December 24, 2022, 8:21am
1
Hi!
I need a help. How to Automatically fetch the table value to another doctype table by drop down menu.
This Doctype name is redirecting and hear I need to get the value of another doctype table by drop down method.
For a example Doctype name value has the table and data init that data I need to be filled in Doctype redirecting table by drop down method:
How to achieve this ?
Thank you.
I did this I’ll share whole example with screenshot give me sometime.
1 Like
VINOTH
December 26, 2022, 4:41am
4
Any, One Know this Solution?
Eli
December 28, 2022, 2:20pm
5
@Hardik_Zinzu -Just bumping this up as I am looking forward to your response
VINOTH
December 29, 2022, 3:50am
6
Hi, @Eli you can try this one,
In my case,
Redirecting is target Doctype.
Value is source Doctype.
Link_1 is trigger value.
table_2 is target Doctype Child table name.
table_1 is Source Doctype Child table name.
frappe.ui.form.on('Redirecting', {
link_1:function(frm){
if(frm.doc.link_1){
frm.clear_table('table_2');
frappe.model.with_doc('value',frm.doc.link_1,function(){
let source_doc = frappe.model.get_doc('value',frm.doc.link_1);
$.each(source_doc.table_1,function(index, source_row){
var addchild = frm.add_child("table_2");
addchild.q_block_no = source_row.q_block_no;
addchild.qg_length = source_row.qg_length;
addchild.qg_width = source_row.qg_width;
addchild.qg_hight = source_row.qg_hight;
addchild.qgcbm = source_row.qgcbm;
frm.refresh_field('table_2');
});
});
}
}
});
This is my Output:
Thank you.