cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
powerapps890
Post Prodigy
Post Prodigy

OnSelect taking me to wrong record

OnSelect is taking me to the wrong record in my form. Sometimes when I choose a record from the gallery it takes to the correct item but other times it takes me to a form of another item. It happens randomly. This is what I am using. 

Refresh('Submitted Requests');If(!IsBlank(LookUp('Submitted Requests', Title=(Gallery2_3.Selected.Title))),Navigate('CR Form',ScreenTransition.CoverRight,{locMode:FormMode.Edit,varRecord:LookUp('Submitted Requests', Title=(Gallery2_3.Selected.Title))}), Navigate('CR Form',ScreenTransition.CoverRight,{locMode:FormMode.New,varRecord:Blank()}))

 

3 REPLIES 3
zmorek
Resolver III
Resolver III

Are there multiple entries with the same Title in the data source or gallery? LookUp returns the first value that matches your formula; if there's multiple entries in the "Title" column that match "Gallery2_3.Selected.Title" it'll return whatever one it finds first. Consider using LookUp with an ID, else consider using Filter.

No they are unique. ID doesnt work for me because it also patches to two other data sources and the ID numbers are off. I have three galleries the first is the one that is originally submitted to when the form is submitted then onsuccess patches to two others. The reason I use title is because the ID's are different from each data source. The only thing I can think of is to override that by using a lookup for the ID so that is forces the other two datasources to use them instead of assigning the number in sharepoint. @zmorek 

joeinmay
Resolver II
Resolver II

Hello @powerapps890 

 

@zmorek  is correct.

 

Try this:

On the select record of the Gallery OnSelect: Set(recID,ThisItem.ID); Navigate('CR Form')

Next on the CR Form edit mode: Item Property: LookUp('Submitted Requests',ID=recID)

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (49,729)