How to keep a child table of one Doctype common with another Doctype?

Lets say I have three DocTypes, Parent1 doctype, Parent2 doctype, and Child Doctype

Now I have added a field in Parent1 doctype as Table and linked my Child table with it.

Now I want the same Child Table with field values to be linked in my Parent2 Doctype. When I am saying this, I mean that any change either from Parent1 or Parent2 would be reflected on the Child Doctype field values.

How can I achieve that?

1 Like

If you explain your use case in more detail, you’ll get more accurate responses.

Do you mean the content of one child doctype will be common across all documents of Parent1 and Parent2? If not, when/how will it vary from one document and another from Parent1 as well as Parent2?

1 Like

Yes I want all rows of Child Type common among both Parents

What do you mean by both Parents? Do you mean all documents of Parent1 and all documents of Parent2? All of them will have one common Child Table?

Hello,
Right if you see child table, it says it has one ‘parenttype’, ‘parentname’, ‘parent’

I am asking is there any way I can link it two parents? Like in database if it can have two parents? Is that possible?

Yes I mean all my child table rows will have two parents and if either parent can update or delete it.

Yes, multiple doctype can use the same child table. So, there will be multiple records of that child table with their own corresponding ‘parent’, it will not overwrite each other.

I was not asking this. I was asking if that same row can have multiple parents.

Hi @Abhiraj_Tulsyan:

At database level, every row has a parenttype+ parenttype + parentdoc, so each row can only depends on one and only one parent.

image

Hope this helps.

Hello I was asking how each row can have two parents!!!

HI @Abhiraj_Tulsyan:

It can’t be done with framework standard capabilities …

As far as I know, this is not possible even in other database outside MariaDB. It’s not really a framework problem or even Python/JS problem at this point based on the question you’re asking.

Hope it’s clear now.