This should be covered in the introductory tutorials.
As suggested by the forum, could you share a clone of the app so that folks can see more clearly what the issue is?
I suspect that you have data binding to a row object instead of the text contained in that object. I’m just guessing though as you have not quite provided enough information.
I fill the dropbox items in Timetracker Form Code line 18 using the values of a table.
I want to manipulate the ‘selected value’ e.g. with string manipulation.
I found in the instructions, how to fill the dropdown, but not how to read a specific value
Currently it looks like your drop down is set to a list of tuples. This is sometimes useful since the text that the user sees is associated with an object (or some other data) that the developer needs to use.
If you want the first part (the string) of every tuple associated with the selected value, you would have to search through the drop down items I believe. Or, if the text you want is also contained in the row object, index into that. Either way, I’m not entirely sure I understand exactly what you would like to do, but I am trying.
You can also just set a drop down to a list of strings in which case the selected value is exactly the same as the text shown to the user.
For example,
my_list=['a', 'b', 'c']
self.drop_down.items=my_list
my_value=self.drop_down.selected_value
# returns whichever value is currently selected
self.projects_dropdown.items = [(r[“project_select”],r) for r in app_tables.projects.search()]
where ‘project_select’ is a field in table ‘projects’
That works good. The system offers the different values of ‘project_select’ in the dropdown field.
Later in code I want to use the actual selected value of the dropdown and save it in a gloabl variable
def projects_dropdown_change(self, **event_args):
“”“This method is called when an item is selected”""
_globals.tt_project = self.projects_dropdown.selected_value
print (self.projects_dropdown.selected_value)
you are asking selected_value to return the corresponding value of r. The dropdown is functioning as a lookup table.
If, instead, you use the simpler r[“project_select”]
you are asking selected_value to return the value of r[“project_select”] itself. Which seems to be what you were looking for.