Populate Child Table with Multiple Fields from parent Document

This is a custom Doctype made to evaluate risks. On the left is the text for the case, the middle is the identifier as a Yes or a No, on the right is a Small text box for details. I could have done this with a child table yes but I didn’t for reasons i’ll explain below.

Use Case: The document has over 100+ questions which identify a case as a risk or not. As the risk form is standard, I wish to have certain questions pre-set into the form and the end user to only select Yes or No and enter all pertaining details (Why I chose not to use a child table for this). Now if a case is identified as a risk, I wish to display it in a table at the end of the form called as Risk Register. Right now I have added a child table field for each Risk case and set the display depends on property to show the risk based on a yes or no, this is bad design i know. Here’s the screenshot:

Now what I want to do ideally is create a child table for both:

  1. The Risk Identifiers
  2. The Risk register

For the Risk Identifier Child Table I want to pre populate the child table, as in the child table should be pre-filled with the 100+ questions.
For the Risk Register, I want it to pull rows from the Risk Identifier Child Table based on their Yes and No.

In summary Basically I want the Report functionality within a doctype, my approach to do this is badly designed, if anyone has any suggestions as to how I should approach this, kindly share. Any help is appreciated.

Okay I’ve found a solution but it requires some work, basically i’ve setup a child table for the register to add rows and display data according to some conditions. Here’s the code:

frappe.ui.form.on("ERMP Script Test", {
	refresh: function (frm) {
		if (frm.doc.ck7 == "Yes") {
			frm.add_child('ermt').category = 'Participant Vulnerability';
			frm.add_child('ermt').risk = 'Does the participant have a history of financial difficulties?',"Participant Vulnerability";
			frm.refresh_field('ermt');
		}
	}
});

ERMT is the name of the child table, ERMP Script Test is the name of the parent doctype.

What this is doing is adding the category and the risk in two separate rows, I want it to add data to multiple fields within one row. This is also duplicating entries each time the form is saved or refreshed