Data Table for Current User

I’ve been struggling with the concept of using the Data Table in the UI. I’m trying to make it that On Page Enter, that the Data Table displays only the row of information from the Database Table that is unique to that Current User. I’ve only found ways to display individual data related within the database data itself and not one linked to the page data. Any help with the code with the data table if its possible, or even other suggestions for displaying the current user’s data would be appreciated!

Hi @SomeOneBeLaggin,

Provide examples of your logic (you can take screenshots), and write actual & expected results. We will try to learn your problem and help you solve it.

Regards,
Bohdan

So for this Data Table in UI Builder (mind the theme), I only want the entire row of data (from ‘UserData’ table in database) to be displayed. The row that I want displayed, is one only related to the current user on the page. But all I can do is display the entire table despite my efforts.


I tried multiple variations of logic, having to do with the whereclause statement. I tried different approaches to changing the table’s property on page enter, as well as load table objects related to currentuser’s id. Ultimately, I am now lost.

Example logic I tried:

Any help with the data table logic, or even alternate solutions with different UI like text boxes to achieve my goal would be appreciated. Also, for reference, I am fairly new to coding, hence the issues, so any help is good :laughing:

Hello @SomeOneBeLaggin,

I noticed from your schema that you have a UserData table. However, it seems that all the columns in UserData could be moved to the Users table. This way, when a user logs in, you can retrieve their data from the Users table using the following query:

objectId='<current-user-id>'

This will result in having only one record per user in the Users table.

For example, if you have orders associated with a user, you can create an Order table and add a 1:1 relation to the Users table with a column named user. To display the orders, you can use the following query on the Order table:

user.objectId='<current-user-id>'

Feel free to ask more questions if you need further clarification!

Best regards,
Serhii

Hi @sergey.kuk

With my information upload, into the already created UserData table, I already have a page dedicated to it. For this, I created the same columns in the Users table, and experimented with the update user role with create object of the information. I could not get this to work on the separate page, would I have to create the objects during the registration page.

This is the code I already have working before support.


Change to either this code, or any other code examples would be appreciated.

@SomeOneBeLaggin ,

If you can’t combine those two tables to one only due to permissions configuration then you can create a custom CloudCode service which will take that data, register user and add all those fields to User table entry. Since CloudCode services use separate API key (CloudCode API key), which you do not expose to the clients, you can give wider permissions to it.

Regards, Andriy