How will the user can access only his data?

Good day! I'm having a problem in my blocks, what I want for every user is to access or list only his added plants and any data he input on my app. I used CloudDB for logging in and signing up, then I use TinyDB for saving the users data, as the get value blocks from the CloudDB can't fit, or can't fill the dictionary blocks using the clouddb blocks. Hope you know what I mean.^^"
So here's my blocks:


The above blocks output is look like this:
It add only one plant1, and if I add another plant, for example plant2, the plant1 will be gone and the plant2 take the place.

What I want is for it to look like this:

I just can't seem to find whats wrong with my blocks, as I'm still new in using MIT App. Hope someone can help me. Thank you in advance!

Hello Bianchix

We can see a few things wrong, for example you cannot save an image in TinyDb unless you encode it (B64 string). Using a Dictionary does not necessarily lead to an easy-to-manage solution. You have a lot of keys - is the User going to search by key? It might be better to have a ListView or ListPicker for the User to select from, thus avoiding typographical errors that prevent search success.

However we cannot really help without seeing all the code that deals with input, output and storage of plant details.

You mean my aia file? Sadly, I cannot post it here, as I will be using it for school project, but maybe I can send it to you, if you wanna check it. ^^"

I don't want to do your school work for you :upside_down_face:

We need to understand what the App should do. It would help if you answered questions put to you.

@bianchix

You can store the images in the app specific directory and access those images just before the plants VA is visible or on Screen1.Initialize()

This depends on whether "all" the plants need to be available in the online database, or not ?

Also note that image storage in cloudDB is currently broken, one needs to convert the image to base64 in order to save it there, and to convert back to display.

He can selectively do it too, by changing the image names according to the plants and dates of planting, and store them in the app specific directory, and use the FileTools (Kodular Community) extension to delete those if required.

@TIMAI2

He actually mentioned that he is using TinyDB to store the images. :sweat_smile:

See Below :

This doesn't make any sense in relation to storing images/data online ????
There is no real requirement for an extension in order to save files/images/data to the ASD.

Because the OP needs to reorganise their blocks in order to use cloudDB as the online datastore. Conversion to base64 still applies regardless of datastore location, if using tinydb to "store" images. Of course the OP can cache the images of the user to the device, to avoid repetitive downloads.

1 Like

Could you tell me how could I, that would be a help to me too. :sweat_smile:

This extension by @Juan_Antonio:

http://kio4.com/appinventor/277i_extension_imagen_string.htm

2 Likes

Yep, I'd be the one will be doing this project of mine, it is just that I'm not sure how I'm going to pull off the app's features; it's far too complicated for me as I'm still new and I can't seem to find something that is really helping me, cause if there is, maybe I'm not here, asking for someone's help.

So here are the app's features; I've already completed some of them, but there's still a significant portion, particularly the database, that I'm unable to complete.
The first is that users can create an account and sign in using the account he created, which I have already done using Cloud DB, I'm thinking of changing it to Firebase as I need the user to be able to access only his account's data, still searching for something that could help me.
After logging in, the user will be taken to the homepage (which still on the process of making).
Following that is the Plants Menu, where users can add their plants and also automatically set alarms and notifications when the plants require watering, fertilizing, and repotting, after the alarm sounds it will be set again, for example, if plant1 requires water every week, the app will sound an alarm and notify the user every week, I guess background tasks extension would help as I need the app to notif the user eventhough the app is closed or not in the background.
Also, if the user clicks on his added plant, it will open something similar to a card view with all of the plant's details and progress, such as how old is his plants, whens the plant last watered, fertilized, repot and its next watering and so on, he will also see a sample picture of how tall the plant or what look it should have by that time.
Users can also view and read tutorials from each plant, which I have done already also.
The crucial part, which I can't seem to get right, is that once a user logs in, he can only access his own data which I do some research and I think Firebase would be a great help than the CloudDB.

Also, I changed my blocks and come up with this blocks:

It output what I want but I can't get where and how I'm gonna add blocks, to be able to save it in DB may it on a TinyDB, Firebase or CloudDB (can't seem to decide what really can help me). Maybe this screenshot of my design would help what data I'm going to save using one tag? Or should I assigned tag in each and every one of it?^^"

How is this not the case? There is only one person per App isn't there? The User Data is stored on the User's device (phone).

What I don't understand about your GUI is this - do the Users add their plants by selecting from an existing database in the App or are they free to add to the database by providing their own data including an image?

You can store the data for one plant in TinyDb as a single comma separated string, including the image encoded to B64. However, you can instead store the data in an SQLite database, which would allow you to give the User a Search facility.

Yes.

What I mean in here is that, I want my user to access only his data. What happening is, when my user created an account, what he input on his other account is still there. ^^"

I see, I'll try to do a research about that.

I think that means he can access his data if he is logged in from another device, right ?

If thats the case, I have some suggestions.

  1. Use TinyDB to store the user data first.
  2. This will allow him to access his data even if he is offline.
  3. Add a backup button that allows the user to transfer his data to the database.
  4. Let the user restore his data from the database just as he does his log in.

Hello. Just wanted to thank y'all for your suggestions and guides.
So my problem is solved through the used of mySQL DB and the link below really helped me also:
https://www.newthinktank.com/2014/05/connect-app-inventor-mysql-database/
Also I tried if I could be able to retrieve the image without the used of BLOB, Base64, etc, I just followed the format on how I saved and retrieved texts and good thing that it worked also for the image that is saved on asset.




Just wondering, coz I'm using a free web hosting, for me to be able to access the php file, is there a chance that I will encounter some problems in the future?

An SQL database can be on the phone, so it is an offline solution too.

1 Like

Does it have to be online?

How?

No, but is it possible to access the data even if its offline?

LOL, I didn't know about that.
I'm not taught about databases actually, except MS Excel and MS Access.

So, I don't know quite about databases.
Just sharing whatever I know.