Hello, I would like to ask for your help. I have an app in which I want to pass many different values from one user form to another screen and store them permanently in TinyDB on this other screen. The problem is, the values are passed, however, when I enter the value in the first text field and pass it to screen2, this value from field 1 settings screen appears in all text fields of screen2. I have never passed values from one settings screen to another screen, and the problem is that there are many different values that should be passed correctly. How do I get this to work, please? Attached are the screenshots of the settings screen and Screen2. Where are the errors, please? Do the passed values also have to be saved on screen 2 with a button? Thank you! Martina
Add all your values to a list, then you only need to store one tag, with that list, and retrieve that tag and its value in the other screen. You can then extract each element by index.
Thank you very much. But how does this work to extract by an index? I never used the values with other screens. Do you mean with values for the list the single variables? Sorry, I am a beginner in this screen value passing. Thanks!
If you use the tinydb on both screens, then you do not have to use the screen value passing blocks. Just, in the second screen, call the tag (that contains the list of values) in the tinydb that you set on the first screen.
Hello TIMAI2, I am not quite sure. How can a tag like a red text block with a word like "erkrankungen" contain a list with the values? Here are my blocks now. What should I do that it could work please? Thank you very much!
You went to a lot of trouble to rename all those Labels to know what's in them.
Unfortunately, you did not change your TinyDB tags to match them.
Thank you I tried it out and it works well, but the last problem is, that, if a user changes one value from the data fields with the personal user entries, the whole other data are deleted, because they are not filled out with new texts. This means, if the user changes one data field he has to renew all the other fields again. How can we please fix this problem? Thank you! I now go to sleep, it is midnight here in Germany. Tomorrow morning EST 7:30 h I am online. Good night! Martina
Yes, your right thank your for your advice. Good night!
Hello Martina
There is a lot going on in your original Blocks. On Screen Initialization:
- You have set the values of Labels with global variable values.
- You have saved the same global variable values in TinyDB.
- You then re-set the values of Labels with the values from TinyDB.
(3) Does not make sense, the values have not changed, although in (1) you have 11 Labels and in (2) you have 11 TinyDB records but in (3) there are 12 Labels....
Also, If the User should be able to modify values, then Text Boxes are required and if using the Blocks List method now, the List must be modified too.
We also do not know why you need to pass the values from one screen to another. It may actually be possible to do everything on one screen......
Perhaps we could help you better if you uploaded your App Inventor Project file to your Forum Topic:
Hello Chris, This app I do not want to upload public. If this app is finished, it should be a commercial app. I think, that the screenshot are enough of the two screens.
The reason, why I am passing values from one to another screen is, that I would like to have a seetings screen for the user for all the settings in the app. I have a screen where the user can input his data, his illnesses, allergies and handicaps and more and then I have a screen where he can fill out a page with the addresses of his doctors. If I would have not a settings screen the user has all the fields where he enters the text on his data page. My goal was to have only the data on the screens without the input fields.
The problem with the texts, which need to update the whole page by the user, if he changes one field, is still not solved. Perhaps you or someone else has an idea please? Thank you very much.
Update: I have thought about everything of this case and I think you are right, if I create the app without a settings screen. I am now working on the single fields to enter textboxes and three buttons also an edit button for the field and button for to hide these input fields. But the feature that the input fields are hidden with visible false needs to be saved also in the TINYDB is this possible please? Perhaps with a variable like "hideFields"? But these fields need to show, if the data of the user have changed, for a e.g. a higher handicap value instead of 50 - 70.
It is possible to keep a record of visibility but I would encourage you to disable rather than hide. Imagine items on your car dashboard being hidden - it's not intuitive, right?
Which ever you choose, you are recording a state - but although you can easily record that certain text boxes are hidden or disabled, how are you going to display or enable them later if a value needs to be modified?
I think disabling will help here - because the text boxes can still be seen, so we can use a "click component" extension and say for example, tap a text box twice to enable it, or if your text boxes have submit buttons, even easier, no extension required. Your code would ideally use the 'any component' tools such that a single event block can perform the enabling of any chosen component (text box) that is found in a List of components, and populate with it's current value taken from TinyDB.
So to recap, once the User has input a value and submitted it, the text box would at that moment be disabled. Since it is the User who decided a value needs to be edited and the User that enables the relevant text box, the App doesn't really "need to know" which text boxes are enabled and which are not, it just needs to know that they are all populated. You can check that with a procedure.
Very well, but it reduces our ability to help you somewhat. The software is free, the technical support and advice is free, but Users, in recognition of this, do share their projects publicly - no doubt you have already benefited from snippets of code from other projects. Unless your code and/or your project is totally unique and patentable, there is nothing to lose and everything to gain.