Copying data from master child table to other child of different doctype

i want to transfer field value from from sale invoice child item to another custom made child table “c1_items” which is child table of doctype call “TR_note” and child table has the following fields as shown in the first photo below Screen Shot 2017-10-11 at 10.59.58 AM.png

now i want to get the value of field “item_link”, “qty”, and “unit” from the standard “ Sale invoice" child table called “sale Invoice items” as shown below Screen Shot 2017-10-11 at 11.00.47 AM.png

I have got custom code from forum but not able to implement into my problem the custom script i have referred is as following

frappe.ui.form.on(“[TARGETDOCTYPE]”, {
“[TRIGGER]”: function(frm) {
frappe.model.with_doc(“[SOURCEDOCTYPE]”, frm.doc.[TRIGGER], function() {
var tabletransfer= frappe.model.get_doc(“[SOURCEDOCTYPE]”, frm.doc.[TRIGGER])
$.each(tabletransfer.[SOURCECHILDTABLE], function(index, row){
d = frm.add_child(“[TARGETCHILDTABLE]”);
from source

i have change the above code as under

frappe.ui.form.on(“TR_note”, {
sale_invoice: function(frm) {
frappe.model.with_doc(“Sales Invoice”, frm.doc.sale_invoice, function() {
var tabletransfer= frappe.model.get_doc(“Sales Invoice”, frm.doc.sale_invoice)
$.each(tabletransfer.Sales Invoice Item, function(index, row){
d = frm.add_child(“c1_items”);
d.qty = row.qty;
d.rate = row.rate;

i get error while running the code … please can you help I’m correcting the code

Hello @jampeltg,

This function should do the job:

Here is an example of the usage from Project (a custom DocType)

Hope it helps!

This function will help us to make the new screen with information from master child table.

How can we do some filter machted item and automatically submit that item in system?

Please @Tai_Tran1 give us more details about your use case to help you better