Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

block duplication

Hello, I had a little problem with how I can ensure that we do not have the Name and year column having both the same value at the same time, because a person can evaluate himself once a year and not several times and if by forgetting the person wants to evaluate himself for the second time during the year that the recording is not taken into account with error message.
If (CountRows (ColEvaluation)> 0;
ForAll (ColEvaluation; Patch ('EVALUATION'; Defaults ('EVALUATION');
{Name: NAME; age: AGE; job: JOB; year: YEAR OF EVALUATION;
score: SCORE; salary: SALARY } ) ) ) ;;
Capture.PNGClear (InventoryCol) ;; Notify ("Your Data's saved successfull"; NotificationType.Success)



After the ForAll you will need an If - check if the current value is already the same as the current year. If so, have it just be false so the  Patch is not performed for that row. Otherwise, do the Patch.


A rough example (not exact, change it to make sense):



If (CountRows (ColEvaluation)> 0;
ForAll (ColEvaluation; If(year = Year(Now()),false,Patch ('EVALUATION'; Defaults ('EVALUATION');
{Name: NAME; age: AGE; job: JOB; year: YEAR OF EVALUATION;
score: SCORE; salary: SALARY } ) ) ) ) ;;


The above example will probably not work as given, it is for rough illustration only, you can check it and change it to make sense for you.



If you must show an error message, you can replace false above ion the If(year = Year(Now()),false,... with something like Notify or some formula that shows error message if the user should be advised what row(s) was/were not saved.


Check if above helps.

Frequent Visitor

Thank you Sir for the answer, By the way the Current year can exist so many times but not at the same time the same name and the same year at the same to avoid an evaluation 2 times, because there can be several times the same year to repeat and the name of the person too

Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,235)