Hello everyone,
I am planning to import a list of all registered medical facilities in our region to ERPNext, the list already arranges them into categories based on the medical specialities the facility provides.
I want to create a custom field called “Medical Specialities” where I can use the data import tool to throw in comma separated values.
You would have to create a new doctype called “Specialities”, and then to that doctype you would have to import your list of 300 specialties. Is that not what you’re looking for? Multiple links against a fixed list?
Can you please clarify how the process goes? According to the documentation I should:
1- Create a custom doctype, let’s call it “SPECIALITIES” then set it as a child table.
2- I would add my different specialities as fields with type of “LINK”. My question is where does these items link to?
Examples of specialities I would have: Pharmacy, Dental, Radiology, Hospital, ENT, GIT, Urology, and 350 more"
3- I would modify the customer’s doctype to have a TABLE MULTISELECT field with links to the doctype I created in step 1.
4- On creation of a customer I can add multiple specialities to that field.
5- I can filter customers with certain specialit-y/ies.
So my question is where should my specialities link in the doctype we create in step 1?
There’s actually one more step here. It’s a bit confusing, because the “Table Multiselect Field” is structured a bit like a Table field, which means it needs to have a bit more structure to it than you might think.
First, create a new doctype called “Specialties”. Don’t set this as a child table. It’s a regular old table that you access directly to define the list of specialties available. The exact structure of this doctype depends on the data you want to store. At minimum, it might have only a single Data field where you store the specialty’s name. It could also have other field like “description”, etc. Import all the specialties you want to define into this table. Down the road, you can add and subtract to it.
Next, create another new doctype. Call this one “Hospital Specialties” or “Customer Specialties” or whatever you like. Mark this doctype as a child table. Give it a Link field, and in the link field set the option to the name of your original doctype “Specialties”.
Finally, in the Customer doctype, create a custom Table Multiselect field, and in the options type the name of your child table “Hospital Specialties” or whatever you put.
This seems a bit confusing, but it makes sense of you think of the content of each database table.
Specialties, the non-child table, contains the list of possible specialties that exists:
Nursing
Oncology
Pediatrics
…etc.
Hospital Specialties, the child table, contains the associations between hospitals and specialties:
It certainly does! To be honest I attempted to do this earlier but I had both tables as child tables so it did not really work.
Thank you for your assistance!
So everything works with the suggested structure, however it doesn’t really save anywhere?
For example on edit of an existing customer, the field will properly display all my specialities list and I can select multiple options.
However when I click on Update or Save, they just simply disappear. If you enter the customer again, the field is empty.
I thought that it might save the associations but does not display them, so I attempted to filter my customers list to a certain speciality which I assigned to my customer but it did not display anything.
Is the link field in the child table set as mandatory? A few users on github have mentioned that’s necessary. If I remove the mandatory flag, I get the behavior you’re describing.
Oh good! It’s mentioned that the field needs to be mandatory in the docs, but in a way that’s much too easy to miss in my opinion. I’ll edit them to make that more clear, hopefully save someone else from your hassle.