Use Table Depending on Category in User Profile

I have a table of products where I need to display fields from the table based on User Type.

I could either have the products as one table, or several tables.

Example:
IF User Type A, then display TABLE A (or FIELD A in Table)
IF User Type B, then display TABLE B (or FIELD B in Table)

I’m a bit stuck with how to structure this in Glide. This would be very simple in a database, but the way I’m looking at glide, I can’t figure out how to get it to use different fields or tables based on the user.

Any thoughts? I’m sure I’m missing something.

If you have your “Type” column in your user profiles sheet, then you can set visibility conditions based on it.

Thanks for the reply.

I think there’s a misunderstanding though. Visibility only works for fields of the table where you have one “user type” per product.

I have 1 product table. And calculations that need to differ based on user type. I can create several tables to do this, or one table with individual columns with the different calculations by user type.

But visibility only allows visibility settings for 1 table from what I can see.

What do you mean by “only allow visibility settings for 1 table”? Can you tell me more about your full flow that you want to have on the front end?

From my understanding you can just create multiple “basic table” components and set different visibility conditions for it based on the user type, or am I missing something?

The “User Type” would have to be a column in the table for it to do that.

That would require that I multiple the same data rows by the number of user types. E.g. 10 user types = 10 rows with mostly the same data except for 2 columns.

Does that make sense?

If you utilize user profiles, you can access that user profile value (role) everywhere in the app. You can set visibility on components based on the role set for the user in the user profile sheet.

1 Like

To add to what Jeff has said above, you can read the documentation about “User profiles” here.

https://docs.glideapps.com/all/reference/privacy-and-per-user-data/user-profiles

After enabling User Profiles, you can use it to set visibility conditions anywhere in your app, it will be visible through a “User” part.

1 Like

Thanks guys, this is looking more like what I was hoping to be able to do. Will go through and see if I can get it to work this way.

2 Likes

Update - yep, this is exactly what I was looking for guys. Thanks! Figured I was missing something.

1 Like

Glad to hear it worked!