Hello guys, thank you in advance for your help. I am creating a format for recording procedures in medical records. Obviously, I am terrible at this. My intention is to create a user input where the user enters the tooth number, the surface (so far, so good) and whether or not anesthesia was applied. From there, I want to insert the text. The problem is that anesthesia can have several types: alveolar anterior, media, post, etc. I would like that when the user enters, for example: Anesthesia = Alveolar anterior, the following text is inserted: ANESTHESIA OF LIDOCAINE 2% WITH EPINEPHRINE 1:80,000, WITH THE TECHNIQUE "ALVEOLAR ANTERIOR". I know that this can be done with the If This.. function, but I was wondering if there is a more efficient way to do it.
I asked Bard for help and he gave me some code that is similar to this. However, I don't know how to use it in my application.
function insertText(anesthesiaType) {
switch (anesthesiaType) {
case "alveolar anterior":
return "ANESTHESIA OF LIDOCAINE 2% WITH EPINEPHRINE 1:80,000, WITH THE TECHNIQUE "ALVEOLAR ANTERIOR"";
case "alveolar media":
return "ANESTHESIA OF LIDOCAINE 2% WITH EPINEPHRINE 1:80,000, WITH THE TECHNIQUE "ALVEOLAR MEDIA"";
case "alveolar posterior":
return "ANESTHESIA OF LIDOCAINE 2% WITH EPINEPHRINE 1:80,000, WITH THE TECHNIQUE "ALVEOLAR POSTERIOR"";
default:
return "INVALID ANESTHESIA TYPE";
}
}
// Use the function
const anesthesiaType = "alveolar anterior";
const text = insertText(anesthesiaType);