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.


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.


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{
	// console.log([key].instructor);{
				method: "ims.ims.doctype.fe_settings.fe_settings.get_employee_details",
				args: {
				callback: function(r) {
					if(r.message) {
							// 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");
					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.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 = '{}'""".format(instructor_id),as_dict=True)
	return teams

I am looking something same like this. I create a field Program(link) to Program. In the Dropdown all the programs are shown. I want to show only that program which the login Instructor enrolled.

s/which/in which