How to use a detail view as a primary view?

I have a users table which includes all users and in addition a security filter for this table like:

[email] = USEREMAIL()

I have a primary view for the users table, which shows a list with one user (the currently logged in user). How can I skip this list view and show the detail view of this user directly?

Hi @tositsa,

Could you please delete the list (Table type)summary view for this users table and create a detail type primary view in UX - >Views pane?

For some reason, if you wish to still retain the table view for say only users with admin role, you could have show_if condition for that table view (list view) something like USERROLE()=“Admin”

2 Likes

@Suvrutt_Gurjar’s response is good. Another possibility is, instead of deleting the table type summary to make it a ref view (assuming that there might be a situation is which you would like to have it).

By the way, I just posted a tip that may be related to your situation:

2 Likes

Aaaah, there is a detail type. I completely missed that. Thanks!

2 Likes

Awesome! It is not applicable right now, but I’m sure it will be soon, thanks!

2 Likes

I have this working now, but how can I control the specific row that is being shown in this case? I wanted to use “Show if”, but I get this message: This formula is not evaluated in the context of a row, so column values are not available.

The detail page data source, let’s call it books, has a unique ID. The current user has a reference to the books table. I want a menu item My Book that displays the detail page of the specific book it references to.
So I created a view My Book, based on the books table of type detail. But it shows a random book, not the one of the logged-in user.

Any ideas?

Hi @tositsa,

Thank you for your updates. The initial thread discussion was about detail view of User table and you also had mentioned use of security filter [email] = USEREMAIL() ,so that the detail view of user table will show only row related to the conerned user as controlled by security filter.

Have you now added a Books table ? Could you please elaborate a little more how the data source Books table is related to the User table?

Ah yes, that is a bit confusing. Let’s start again:

  • I have a user table with a security filter [email] = USEREMAIL()
  • This user table has a reference to the books table: books_id
  • I have created a view My book of type detail, where I want to only show the book that was linked to in the user table.
  • This My book view needs to be accessible from the bottom menu (which I did).
  • This My book view current shows another book from the books table than the one I expect.

(I guess the security filter is not relevant here)

@tositsa
Do you have a security filter in Books table? If not, you need to filter that table as well because filtering out Users table does not automatically filter the Books table. You can use an expression like this (assuming that you have a [User ID] column in Books table) to filter Books table:

IN(
	LOOKUP(USEREMAIL(),"Users","EMAIL","User ID"), [User ID]
)

Hi, no I don’t have the security filter there, because I want users to be able to see other entries in the books table, just not in this detail view.

Also, I don’t have a user_id in the books table, because different users can have the same book as “their book”. So user.book_id point to book.id, but not exclusively.

Gotcha. But can you elaborate this part in your thread?

The details of the first book in the books table is shown. So I was hoping to add a “Show if” to make sure it is the right one, but I got the message: This formula is not evaluated in the context of a row, so column values are not available. then.

@tositsa
You can set an expression like this for the Initial View of your app:

LINKTOROW(
	ANY(
		SELECT(
			Books[Book ID],
			IN(
				[Book ID],
				SPLIT(
					SELECT(
						Users[Related Books],
						[Email]=USEREMAIL()
					),
					","
				)
			)
		)
	),
	"Books_Detail"
)

OR

LINKTOROW(
	ANY(
		FILTER(
			"Books",
			(IN(
				[Book ID],
				SPLIT(
					SELECT(
						Users[Related Books],
						[Email]=USEREMAIL()
					),
					","
				)
			))
		)
	),
	"Books_Detail"
)
2 Likes

@LeventK oh wow, that’s awesome! Maybe this is no longer no-code, but it will do! :slight_smile: