Hello Anvil
I am new to this platform and this is my first post. I hope to have your collaboration.
I’m doing the Anvil tutorials and I ran into a problem. The toturarial I am developing is:
The issue is that you don’t load the data into a component. more precisely do not load the equipment in the dropdown. I bring the team data from the employees table.
Code to load team name in the dropdown
.
f you can help me, why is it not loading the team names in the dropdown? I am following the tutorial as I said: “Displaying Data In Tables. Add Widget”. Hoped for your help. Thank you.
Pablo Almada
Hello and welcome to the forum.
Form a quick look, the code seems to be ok. Have you tried adding a print statement to print the number of employees being returned from the server call? My guess is that the search iterator that is returned from this call is empty.
print("Employees length: ", len(employees))
Also I am assuming the team
column is a text column?
Does the dropdown show “Invalid value”? This probably indicates that you have no data or wrong data. You need to pass a list of tuples to the dropdown.
For example:
self.drop_down_team_add.items = (("Team 1", [team_data_1]), ("Team 2", [team_data_2]))
Hello. I already corrected the error. I need to place the key-value correctly within the code. This is how I did it and the application works fine for me:
**self.drop_down_team_add.items = [(team, team) for team in sorted_unique_teams_list]**
But now I have a new problem. Guided by the tutorial, I created a client-side module and within this module a function. The issue is that when I run the application I get a message that I put below. If I add the code of the function in the form and uncomment the import of the function within the client module and uncomment the invocation of the function within the client module, then the application runs well and works. The question is why do I get this message when I want to import and use the function within the client module?
Read the message closely. “…not currently installed in the server environment of this app.” (Emphasis mine.)
This occurs only if there is a server-side import
that fails to find what it is trying to import
.
Anvil has no way of knowing whether that failure means a lack of a third-party module, or one of your own, but the former is fairly common.
Look for that failed import
on the server side. Once you find it, you may find a misspelling, or the name has changed, or its location is not what the import
was expecting, …
I already solved the problem and it works fine for me. An error in the syntax of the import of the client module function. This is how it looks:
from …ParseEmployeeName import parse_employee_name
Thank you.
1 Like