Hey All, sorry for the noob question, but I have been banging my head against this for a while:
What I’m trying to do:
Pass text data out of a data table to a label field following a user input form. The longer goal is to create a table of user inputs that can be put into a templated form as a pdf. But currently I am stuck on the “get the data out” part
What I’ve tried and what’s not working:
I can get the data from the input form into the data table, but trying data bindings and self.name.text hasn’t worked.
I have tried simplifying my data input into a test project with 1 input field and 1 output field. I would appreciate some guidance.
Hello and welcome.
Could you share the server code that you are using to get the data back to the client as well as the code that you are using in the client (and the error if there is one)?
I’m on my phone so the clone won’t help me but I’m sure the code would.
Hi Campopianoa thanks for helping out, here is my server code to load and search the data table
Okay, how about the client code where you are trying to set the text property of the text box?
You will have to call
get_name in the client and pass its values to the components that need them.
I was trying something along these lines on the report form:
def init(self, **properties):
# Set Form properties and Data Bindings.
self.label_1.items = anvil.server.call(‘get_name’)
I don’t belive I saw that in your app. Perhaps I missed it.
The text on a text component can be set with:
Once you have your data, if you want to pass it to another form using “open_form”, you can do:
That passes foo to the init function of “your_form”. You can get it out of the properties argument in the init (or change the function signature to accept an argument).
as opposed to passing it from one form to another, is there a way to call the value from the data table?
so for this app the apptable is ‘data’ with only 1 column fname
so would it be:
Yes you can do that if you want the client side to have direct access to the database (read the docs on datatables to learn how). For security reasons, it is far more common to pull data from the datatables through dedicated functions.
Hi not sure if Im doing the right thing by reviving this topic, but I am because I stumbled across it while looking for how to populate label text from the database. We need to do this a lot in Canada because Canada is officially bilingual – English and French.
So here’s a clone you can try out. Note, I have also included Hindi to show that you can also do this with multiple scripts. Feel free to use my clone.