CRUD Datalist for logged user only

Hi Folks,
Kindly share how to make it possible to display CRUD Datalist for logged user only. Example We will have list of to-do list for multiple users but one specific user log in, datalist need to show this user’s to-do lists only.

Thanks
Nyi Nyi Lin

Hi Nyi Nyi Lin

Always happy to help here on the forum but you need to provide more information so we can help.

How is the data stored - database?

My approach would be a user table with primary key and a todo table with a foreign key to the users.

If that is the case then you need a method to create the database users first.

There are a number of tutorials on setting up logins etc already on this forum or the intial parts of the blogging series (latter parts still under construction) deal with this.

Once the login is set up then it is a simple case of setting up a query to select the todo contents filtered on the security.identity variable (users identity) and the list will be filtered by the current user.

1 Like

Thanks so much for your help.
Could you share example query string for filtering with current user Id?

Yes.once you have set up your security login all you need is to make your database connection, and add the security provider (i have called dummy in this example) you have defined when configuring your login stage.

image

Then create a database query and select the fields you need from your table. for example;

then filter by identity

so your query will be:

You may benefit from viewing some of my “Introduction to Wappler” videos here which explain a lot of basic concepts.

1 Like