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 / DetailScreen broken
Power Apps
Answered

DetailScreen broken

(0) ShareShare
ReportReport
Posted on by

Greetings,

 

To avoid delegation issues, I have decided to use ClearCollect to bring in a filtered set of Data from a Sharepoint List:

 

//Set variable for current date
Set(
	CurrentDate,
	Date(
		Year(Today()),
		Month(Today()),
		Day(Today())
	)
);

//Set variable for start of previous work week
Set(
	PeriodStartDate,
	DateAdd(Now()-6,-(Weekday(Now(),StartOfWeek.Sunday)),Days)
);

//Set variable for send of current work week
Set(
	PeriodEndDate,
	DateAdd(Now(),-(Weekday(Now(),StartOfWeek.Sunday)),Days)+7
);

//Pull in collection

ClearCollect(colEntries,
 ShowColumns(
 SortByColumns(
 Filter('Entries','Entry Date and Time' >= PeriodStartDate,'Entry Date and Time'<= PeriodEndDate),
 "Entry_x0020_Date_x0020_and_x0020",Descending
 ),
 "Employee_x0020_Name","Entry_x0020_Date_x0020_and_x0020","In_x0020_or_x0020_Out","Location","Comments","Branch","OutType","ReturnDate","Building","ID"
 )
);

 

I have created a screen with a gallery which has a data source of colEntries.  My EditForm has a datasource of 'Entries'.  When the Form is submitted, it creates the new record in the Sharepoint List and then the ClearCollect runs again to update the collection.  The problem is my DetailForm.  How can I get the nextArrow in my Gallery for each record to open the Detail Form for the record in the Sharepoint List?  I have the ID field in the Sharepoint List, as well in the collection. 

 

Currently, the NextArrow in the gallery is set to Select(Parent).  I was thinking about doing something like Select(LookUp('Entries',ID=ThisItem.ID)), but it doesnt work.  Basically, I want it to look at the ID listed in the collection, then match it with the record in the Sharepoint List, and select that record for the DetailScreen.  Any help would be greatly appreciated.

Categories:
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @john3j 

    The key is the Item property of the Detail form.  Set it to Lookup(Entries, ID = yourgalleryname.Selected.ID).  There is no need for a variable here.

  • john3j Profile Picture
    on at

    @Drrickryp - Thank you for such a quick response!  That seemed to do the trick, but I also have a delete icon that is throwing fits.  Given your advice about the Item Property on the Detail Form, what would I need to set the OnSelect property to on the IconDelete1?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @john3j 

    I wouldn't use a collection for the gallery.  You could populate the gallery with the Items property 

     

    With({
     mydata: Filter(
     Entries,'Entry Date and Time' >= PeriodStartDate,
     'Entry Date and Time'<= PeriodEndDate
     )
     },
     SortByColumns(
     mydata, "Entry_x0020_Date_x0020_and_x0020",Descending
     )
    )

     

    or getting rid of the collection and the variables

     

    With({
     PSD:DateAdd(Now()-6,-(Weekday(Now(),StartOfWeek.Sunday)),Days),
     PED:DateAdd(Now(),-(Weekday(Now(),StartOfWeek.Sunday)),Days)+7, ,
     mydata: Filter(
     Entries,'Entry Date and Time' >= PSD,
     'Entry Date and Time' <= PED
     )
     },
     SortByColumns(
     mydata, "Entry_x0020_Date_x0020_and_x0020",Descending
     )
    )

     

    You can populate the labels in the gallery by simply putting in ThisItem.columnname .  For the delete record icon, simply Remove(Entries, ThisItem)

  • john3j Profile Picture
    on at

    @Drrickryp - The reason I was using collections was because I expect 1800-ish records per day and I have to be able to quickly recall the past two weeks worth of data without running into delegation issues.  How would I get the delete button to work where it finds the ID of the record in the collection, then matches it with the corresponding record in the Sharepoint list with the same ID?  I really appreciate your help on this!

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @john3j 

    Remove(Entries, Lookup(Entries, ID=ThisItem.ID) but you will have to redo the collection to show the change in your gallery. You do realize that ClearCollect() is not delegatable so it is only collecting the first 2k items in your list. To check do a CountRows(colEntries)to see how many items you have.

  • john3j Profile Picture
    on at

    Perfect!  Thank you so much!

  • john3j Profile Picture
    on at

    @Drrickryp  - I actually have collections for multiple branches, then I do a ClearCollect to pull them all into a larger collection.  This was my attempt at working thru delegation issues and it seems to work...for now 🙂

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 150

Last 30 days Overall leaderboard