I am creating two SharePoint lists that are connected to a PowerApps application. The SP List1 "TripsList" shows all the trips a person can choose, and the SP List2 "Destinations", shows all the destination a person might be within a trip.
The relationship is one to many since one person might be in more than one destination during the same trip. For this, I created a column named "Identifier" which connects both lists. In the SP List1 the "Identifier" will be used only once, however, in the SP List2, it might be used more than once
The List2 has two additional date column; "FirstDate" and "EndDate". The end-user must select the start and end date in each destinations in the SP List2.
The List1 has a date column named "FlagFirstDate".
I would like to create a rule to gather the closer date of each trip in the SPList1 ( to be store in the column "FlagFirstDate".), based on all dates the end-user select in the field "FistDate" within the SPList2.
For example, if I have 3 destinations in SP List2 with the same identifier 1111 , then the "FlagFirstDate" on the SP List1 for the identifier 1111 must be filled with 02/10/2020, since this is the closer date (the smaller)
There are two SharePoint lists "TripsList" and "Destinations", both are connected by an identifier-field with a number e.g. "1111". A user can select a trip from the "TripsList" and select different destinations for this trip.
First questions: can only one user book a trip, so when a user already booked a trip, it is not visible to other users anymore?
To solve your problem, you can use the First()-, Sort()- and Filter()-Function. Your code should look like:
Then you should receive the first date from you "Destinations"-list for the trip with the identifier "1111" (you can test it within a label first). To update this item, you could use the patch()-Function, to update the value within the "TripsList".