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

distinct function confusion

Hi there,

My app is a registration tool for carpooling, to and from our work place.

My data source is a table (stp2) which contains user and app inserted records:

Date, Name, Arrive(0/1), Departure(0/1), TimeStamp, Station number

 

For example:

Date

Nam

Ar

Dep

Stamp

stn

18-Dec-17

Buki

1

1

18-01-18 16:30:00

0

18-Dec-17

Guy

0

0

19-01-18 16:30:00

2

18-Dec-17

Ari

1

1

20-01-18 16:30:00

2

18-Dec-17

Mose

0

0

21-01-18 16:30:00

3

19-Dec-17

Tibor

1

1

22-01-18 16:30:00

4

19-Dec-17

Alvaro

1

1

23-01-18 16:30:00

4

19-Dec-17

Barak

1

1

24-01-18 16:30:00

5

19-Dec-17

Tamar

1

1

25-01-18 16:30:00

5

19-Dec-17

Hila

1

1

26-01-18 16:30:00

5

 

Ar for arrival and Dep for departure

The car pool driver has a second screen where she/he can select a day with a gallery which contains group of people names who have registered to the car pool that day, sorted by station number and by time stamp of the registration. I use this gallery data items function:

 

SortByColumns(Filter(stp2,Text(Date,  "[$-en-US]ddd dd-mm-yyyy") = Text(DatePicker1.SelectedDate, "[$-en-US]ddd dd-mm-yyyy")),"stn",SortOrder.Ascending,"Stamp",SortOrder.Descending)

 

However, people sometimes have regrets and thus register and then unregister to this service, so we get gallery records like these:

14-Mar-18

Guy

1

1

12-03-18 16:00

14-Mar-18

Ari

0

0

13-03-18 15:00

14-Mar-18

Ari

1

1

12-03-18 16:00

14-Mar-18

Barak

1

1

12-03-18 16:00

14-Mar-18

Hila

1

0

13-03-18 16:00

 

 

 

 

 

 

 

 

Ari has two registrations and I would like to retain just the lase registration (obtained by time stamp of his entry). This gallery should look like this:

14-Mar-18

Guy

1

1

12-03-18 16:00

14-Mar-18

Ari

0

0

13-03-18 15:00

14-Mar-18

Barak

1

1

12-03-18 16:00

14-Mar-18

Hila

1

0

13-03-18 16:00

 

 

I’ve tried the Addcolumns and Distinct functions to create the new gallery with no success.

Could you please help?

Thank you

 

2 REPLIES 2
Super User
Super User

Re: distinct function confusion

@arigl

 

i am a bit confused about the functionng of the app, and thus have a question on that before I can help any further.

 

As per what you have told, will users be basically adding a new record when they are unregistering from the service?

 

If that's the case, i would recommend that instead of creating a new record to unregister , the user should be allowed to edit an exisiting record.

 

For. eg. if Ari registered for the service by entering these -

14-Mar-18

Ari

1

1

12-03-18 15:00

 

Then when Ari opens the app again, he/she should be able to see this record and be able to edit it (only allow editing/changing  Ar & Dep fields) and you could add another column "Last modified" and can record the timestamp of editing.

 

I hope this helps. (and doesn't seem too vague)

 

let me know if you have any questions

 

Vivek

Interested in creating Click-Through Analytics for your PowerApp? 

Click here to watch the Webinar on April 17th 10:00AM PST, 1:00PM EST


Vivek Bavishi aka That API Guy
PowerApps and Flow MVP
Blog | Twitter | YouTube | Community Profile | GitHub



If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted
arigl
Level: Powered On

Re: distinct function confusion

Thank you Vivek for your answer.

This is for sure a simple method for the app creator, however from the user point of view I whould like to minimize user interaction and to keep record of the registration and unregistration in the table, thus I prefer that only the gallery will show the last entry.

 

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,303)