web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Displaying a record ba...
Power Apps
Unanswered

Displaying a record based on ThisItem or Selected

(0) ShareShare
ReportReport
Posted on by 57

I have a standard mobile app, with a gallery, details form and edit form, with a slight twist in the OnSuccess method in the edit form. If the data entered meets certain criteria, the app navigates to the display screen rather than the gallery and displays the record with some additional information.

 

At present, I've got the Items property on the Details forms set to LookUp('[dbo].[Observation]',ID=varCurrRecId), where varCurrRecId was set in the EditForm's OnSuccess event or by the gallery Select event but it's slow and confusing as an old record might show for a second or two.

 

I want to base the record on ThisItem or EditForm.LastSubmitted, like Carlos does in his Decoupling the Gallery from Forms post.

Carlos doesn't mention what he set the DataSource property to and I get an "Invalid formula. Expected a value compatible with 'DataSource'" error when I set the item property.

 

Does this technique still work? If so, is the DataSource simply set to the same DataSource as the gallery, which is Observation for me?

Finally a shout out to the speed and quality of the answers here. Really appreciate that.

Navigate('Event Details', ScreenTransition.None, {varCurrRec: BrowseGallery1.Selected});

 

PowerAppItem1.png
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,382 Most Valuable Professional on at

    Hi @nigel_s ,

    Your Item property of the form is a sound and flexible method (and is exactly what I use for other reasons)

    LookUp(
     '[dbo].[Observation]',
     ID=varCurrRecId
    )

    The only difference is that I use a Global Variable to be able to set it elsewhere.

    So all you have to do is set it and and then Navigate to the screen

    Set(
     varCurrRecID,
     EditForm.LastSubmitted.ID
    );
    Navigate(
     'Event Details', 
     ScreenTransition.None
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • nigel_s Profile Picture
    57 on at

    Hi @WarrenBelz,

     

    As you said this is a reliable method (I use the global var as well). I have an issue when the user visits the detail screen, goes back to the gallery, adds a record and clicks save. At this point, the app navigates to the details screen, and for a second or two, the data from the previous record is visible. This is quite distracting. I am trying a spinner image to show data is loading but is there a way to blank the detail screen on arrival? A blank screen would be much better than the old data. I'll keep the loading image as well but I'd love to get rid of the previous values.

     

    Thanks so much,

    Nigel

  • WarrenBelz Profile Picture
    156,382 Most Valuable Professional on at

    Hi @nigel_s ,

    A loading spinner set to Data type is sometimes good as it should not display the screen until all data required is captured.

    You can always do one of your own on a timer - put a rectangle on the whole screen with Fill RGBA(138,138,138,0.5) and put the attached icon on top. Group them and set the Visible to a Variable which you can also use to initiate the Timer Start and then set to false on the OnTimerEnd.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

     

    Spinner1.gif
  • WarrenBelz Profile Picture
    156,382 Most Valuable Professional on at

    Hi @nigel_s ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • nigel_s Profile Picture
    57 on at

    Hi Warren,

     

    Thanks for checking in. Yes, I do have a question. To recap, I've got an edit screen that returns to a detail screen. If the details screen has been used it's set to the previous record. Details does a lookup to get the right record but it takes a moment and I want to display my own spinner (LoadingSpinner.Data isn't working for some reason) while the record is loading. The question is how do I remove my spinner when the record is loaded?

     

    My thinking was, every record has a modified date, it's impossible for two to have the same time. I pass the modified time from the gallery or edit screen to the details screen. If it's different than the current value, then I want a spinner, when the values are the same, remove the spinner. Question is how do I know when the value changes? I use another low code solution, K2, and in that environment, a change event is triggered whenever a value changes but that doesn't seem to happen here. My brief testing shows the event only triggers when the user changes the value, not the system.

     

    I thought about having a 100ms timer to check the value but I'm not sure if there is a better way.

     

    Thanks so much...

  • WarrenBelz Profile Picture
    156,382 Most Valuable Professional on at

    Hi @nigel_s ,

    Interesting thought, the one thing I would comment on is that the Date/Time Lookup is a server call to the data source which will take a period to execute and maybe defeat the purpose of the exercise. I hide a lot of things behind spinners and users seem to accept a two second display as just being part of the app. I have a couple where the displayed galleries on the form are from collections which are run on an "Enter System" button on the Intro screen. I set the Visible at the start then turn it off at the end of the collection code and it works as expected.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • nigel_s Profile Picture
    57 on at

    Hi,

    I am comparing a Datacard value with the context variable, so that should be local and speedy.

     

    Can you confirm that the OnChange event is not generated when the system changes a value? Is there an event or another way to tell when a Datacard value changes? I use this pattern a lot in K2 - it can be difficult to trace all the events triggered in this model - but it's an easy way to check for changes.

     

    Thanks

  • WarrenBelz Profile Picture
    156,382 Most Valuable Professional on at

    Hi @nigel_s ,

    The OnChange event refers to the property of a Control, so if you for instance doing a Patch on the same field, it certainly would not trigger.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • nigel_s Profile Picture
    57 on at

    Yes of course because that's a more database bound operation but what about the change of a Datacard value? I'm thinking when the system loads a new record and the value changes, I'd like to see that event, or if a custom TimerEnd statement, set a datacard value, would that trigger an OnChange? These are changes in the local screen, which affect the on-screen values, can we see those?

     

    In other words, is there a better way than my hokey timer event, to know when a value has changed. A timer feels like the wrong way to do this but I don't know another way.

  • WarrenBelz Profile Picture
    156,382 Most Valuable Professional on at

    Thanks @nigel_s ,

    There are only two ways of changing a Control value - user input or a Reset. I would imagine both would trigger any OnChange event attached.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#2
11manish Profile Picture

11manish 205 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard