How to retrieve values from a Table Multiselect field in a single DocType?
For example, to retrieve the API key:
api_key = frappe.db.get_single_value(‘Stock Alert Settings’, ‘twelvedata_api_key’)
Now, how can I retrieve data from a Table Multiselect field?
Hey, I found a solution to this issue:
countries = stock_alert_settings.get(‘country’)
country_names = [frappe.get_doc(‘Country’, country.get(‘name’)).country_name for country in countries]
Here, ‘Country’ is the main doctype that stores all country data in Frappe.
1 Like
Hi, can you explain your solution? Thanks
This can also be helpful:
professions = [
frappe.get_doc(“Profession”, profession.profession).prof_name.lower().replace(" ", “-”)
if frappe.get_doc(“Profession”, profession.profession).prof_name else “”
for profession in self.professions
]
# Combine the professions into a single string
combined_professions = "-".join(professions)