Multiple select field for 300+ Items

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.

For example:

418 Hamarain Center	**Nursing, Diagnostic Radiology, Director, Radiology, Radiology Allied Healthcare**

Later on I can filter my customer list to only get those that provide radiology.

I have seen this but I don’t think it’s valid when I have 300+ categories.

Please recommend a solution for this
Thanks

Hi there,

Do you mean that a give hospital might have 300+ categories? Or that there are 300 categories in total? If it’s the latter, it should work fine.

What I mean is, I would have 300 different soecialities and I would assign them to customer

For example
Hospital A. ENT, Cardiology, Radiology, Pharmacy
Hospital B. Radiology, Gynecology, Internal Med
Medical Center C. Dental Radiology.

I do understand that the doctype would work. However, I have to manually add to the table 300+ rows

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?

Oh okay, never thought about using data import tool with a custom doc.

Thank you for your time and effort in assisting me, I really appreciate it.

1 Like

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:

  • Hospital A - Nursing
  • Hospital A - Pediatrics
  • Hospital B - Nursing
  • Hospital B - Oncology
  • Hospital C - Nursing
  • …etc.

Does that make sense?

1 Like

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!

1 Like

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.

Hmm…that’s really weird. I can’t think of an obvious reason why that might be happening. I’ll try to reproduce this evening.

Let me know if you conclude anything, l have experimented a lot with this but still, nothing.

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.

1 Like

Nope didn’t set it as mandatory, let me test it

Edit: It actually worked after I set the ID field as mandatory.
I appreciate your help.
Thank you very much!

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.

1 Like