cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gines
Level: Powered On

Navigate to another screen by lookup column

Hi,

 

I have 2 SharePoint lists:

  1. List 1 with a Title column and other columns
  2. List 2 with a Title column and a Lookup column to Title in List 1

I also have 2 screens:

  1. Detailscreen 1 with the columns and values from an item in List 1
  2. Detailscreen 2 with the lookup column in List 2 and a button. When I click on the button, it should navigate to detailscreen 1 with all the values from an item in List 1.

How can I achieve this? I compared the value of the lookup with the title, but how can I pass the value to the Navigate function?

 

Is it also possible to search for text and a person field in 1 searchbox?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Navigate to another screen by lookup column

Hi @Gines,

 

First of all, you need to notice that the Title field in List1 need to have enforced unique value. Otherwise, when you have one value from Lookup column in List 2, it could point to multiple items corresponding in List 1. 

 

If your Title field in List1 has unique values, then this could be achieved by following below steps:

1. Create the auto-generated app using List 2 as the connection. 

2. Insert a new screen, name it "DetailScreen2". In this screen, insert a display form, and set its DataSource property to:

'List 1'

Set its Items property to:

First(Filter('List 1',Title=DataCardValue30.Selected.Value))

 

Notice that DataCardValue30 is the control name of the Lookup column data card on DetailScreen1.

Capture.PNG

 

3. On DetailScreen1, insert a button and set its OnSelect property to:

Navigate(DetailScreen2,None)

 

I just tested and this works.

Capture.PNG

 

 

About the search box, did you mean search for Gallery control? If so, then notice that Search Function supports only string searches. That means that you can use it with text column, but not with Person and Group column. But you can use Filter / Lookup functions which could work with Person and Group fields. The formula could be something like:

 

Filter('List 2', StartsWith( Title,TextSearchBox1.Text ) || StartsWith( Person.DisplayName, TextSearchBox1.Text ) )

 

This filters the 'List 2' data source for records in which either the Title column or the Person column starts with the search string in TextSearchBox1 textinput control. The || operator is true if either StartsWith function is true.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Navigate to another screen by lookup column

Hi @Gines,

 

It seems like you are working with generated Forms from SharePoint list.

 

First of all I would to tell you that lookup columns are not good type of columns to use with PowerApps. PowerApps is working like visualization/input for data from many sources, SharePoint lists for example. And also PowerApps can merge data from separated lists and display them as one item based on some relation (ID). So there is same function like lookup directly in PowerApps.

 

For example you have one list with "Name", "Surname", "Phone", "Location"

Second list with "Location Name", "Location Address"

Location in first list is represented by Location ID - such ID is created by SharePoint itself for each item in list in default. there is no need to manage it anyhow. So you see just IDs of items in Location list. In PowerApp you can display for example in gallery or however you want all informations - Name, Surname, Phone, Location Name, Location Address in one screen. Similar to lookup in SharePoint lost column.

 

There is no way to put data to Navigate function. There is need to use for example collection, better description here - https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/create-update-collection. Collection works like internal storage of data for running PowerApp. When PowerApp is closed such data are lost. So when you click on button you can do for example ClearCollect() to gather needed data.

 

There is possible to look throught other columns in Searchbox, but there is need to change/update its functions.

P.

Community Support Team
Community Support Team

Re: Navigate to another screen by lookup column

Hi @Gines,

 

First of all, you need to notice that the Title field in List1 need to have enforced unique value. Otherwise, when you have one value from Lookup column in List 2, it could point to multiple items corresponding in List 1. 

 

If your Title field in List1 has unique values, then this could be achieved by following below steps:

1. Create the auto-generated app using List 2 as the connection. 

2. Insert a new screen, name it "DetailScreen2". In this screen, insert a display form, and set its DataSource property to:

'List 1'

Set its Items property to:

First(Filter('List 1',Title=DataCardValue30.Selected.Value))

 

Notice that DataCardValue30 is the control name of the Lookup column data card on DetailScreen1.

Capture.PNG

 

3. On DetailScreen1, insert a button and set its OnSelect property to:

Navigate(DetailScreen2,None)

 

I just tested and this works.

Capture.PNG

 

 

About the search box, did you mean search for Gallery control? If so, then notice that Search Function supports only string searches. That means that you can use it with text column, but not with Person and Group column. But you can use Filter / Lookup functions which could work with Person and Group fields. The formula could be something like:

 

Filter('List 2', StartsWith( Title,TextSearchBox1.Text ) || StartsWith( Person.DisplayName, TextSearchBox1.Text ) )

 

This filters the 'List 2' data source for records in which either the Title column or the Person column starts with the search string in TextSearchBox1 textinput control. The || operator is true if either StartsWith function is true.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Gines
Level: Powered On

Re: Navigate to another screen by lookup column

Hi @v-monli-msft

 

Thank you for your answer. The lookup navigation worked as expected! My problem was that I changed the datacard field from "View selection" to "View lookup". The Datacardvalue.selected.value wasn't appearing because of my modification.

 

Now I need to experiment with the searchbox to search for a string and people field. StartsWith is a good function to experiment, but I also need to search in the middle of a string and not only the start. I will update my post if I find a solution.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,255)