Is there any way to show the data in a link field based on a condition

Hi Everyone,
I have to show the all instructors in website.So i have created a check box field in instructor.And i have created a child table in website settings in that i have a link field instructor when the checkbox is checked in the instructor it must show all the checked instructors and i dont want to see the unchecked instructors in the childtable link field instructors in website settings.

Thanks

What that checkbox is for? If you add a field called Enabled/Disabled, then in the link field, you will only see enabled records for that Doctype.

@umair

The checkbox field is in the instructor doctype.when the checkbox is checked the link must show the checked instructors.

This will also require scripting to make it work. Have you written any? If yes, please share it here.

@umair yes.I have wriiten the script.
js file

frappe.ui.form.on("Team", "instructor", function(frm,cdt,cdn) {
	
	for(key in frm.doc.team){
	// console.log(frm.doc.team[key].instructor);
	frappe.call({
				method: "ims.ims.doctype.fe_settings.fe_settings.get_employee_details",
				args: {
					"instructor_id": frm.doc.team[key].instructor,
				},
				callback: function(r) {
					if(r.message) {
							console.log(r.message[0]["instructor_name"]);
							// locals[cdt][cdn]['instructor'] =r.message[0]["name"]
							locals[cdt][cdn]['instructor_name'] =r.message[0]["instructor_name"];
							locals[cdt][cdn]['phone_number'] =r.message[0]["cell_number"];
							locals[cdt][cdn]['designation'] =r.message[0]["designation"];
							locals[cdt][cdn]['email'] =r.message[0]["company_email"];
							locals[cdt][cdn]['image'] =r.message[0]["image"];
							// refresh_field("team");
							refresh_field("instructor_name");
							refresh_field("phone_number");
							refresh_field("designation");
							refresh_field("email");
							refresh_field("image");
					}
					else{
					frappe.throw("please tick show in website in Instructor")
					// 	console.log("hello");
					// 	cur_frm.get_field("team").grid.grid_rows[key].remove();
          			// refresh_field("instructor")
					}
				}
		});	

	}
		
});

@umair and the py file

def get_employee_details(instructor_id):
	teams = frappe.db.sql("""select tabInstructor.name,tabInstructor.instructor_name,tabEmployee.image,
		                  tabEmployee.designation,tabEmployee.company_email,tabEmployee.cell_number from tabEmployee 
						  right join tabInstructor on tabEmployee.employee=tabInstructor.employee where tabInstructor.show_in_website = 1 and tabInstructor.name = '{}'""".format(instructor_id),as_dict=True)
	return teams