I’m afraid I’m at a disadvantage because I don’t understand the script in your screenshots, so please bear with me.
It appears the chosen doctor’s name could be enough to locate the doctor’s email address–if each doctor will only have one email address. If so, you could try something like this as the Initial value expression:
doctor-name with the name of the column of the form containing the chosen doctor’s name,
table-with-email doctor with the name of the table containing the email doctor column, and
doctor-name-column with the name of the column in the
table-with-email doctor table that contains doctor names.
If a doctor could have different email addresses depending on specialty and/or sub-specialty, the above will not work. If that’s the case, let me know and we’ll try something else.