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

Assign only unique numbers to items using ForAll and Patch

One Gallery has a list of transactions and one collection has a list of unique numbers.

On select, I need to assign the unique numbers to each filtered transaction.  I managed it with the formula below.  (Thanks, Mr. Dang for your videos.)

 

However, when I added a new transaction in the same group and click the button, I need to assign the next unique number to the new transaction, but the first number in the collect was assigned.

 

Can you help me how to modify my formula to do the task?

Thanks in advance.

 

OnSelect=

ClearCollect(CasNumOption,Cashier_Num);
ForAll(Gallery1.AllItems,
    Patch(Reservation_Record,
        First(Filter(Reservation_Record,And(R_Date > DatePicker1.SelectedDate-1, R_Date < DatePicker1.SelectedDate + 1, Cashier_Num2 = 0))),
        {Cashier_Num2: Value(First(CasNumOption).Cashier_Num1)}
);
    Remove(CasNumOption,First(CasNumOption))
)

1 ACCEPTED SOLUTION

Accepted Solutions
MikeLSS
Level: Powered On

Re: Assign only unique numbers to items using ForAll and Patch

Actually, I found a solusion by myself.

FYI here:

 

I made another collction collecting the used Unique numbers, then removed duplicated numbers from the 1st collection with the used Unique numbers.

 

ClearCollect(CasNumUsed,ShowColumns(Filter(Reservation_Record,And(R_Date > DatePicker1.SelectedDate-1, R_Date < DatePicker1.SelectedDate + 1)),"Cashier_Num2"));
RemoveIf(CasNumOption,Cashier_Num1 exactin CasNumUsed.Cashier_Num2);

View solution in original post

1 REPLY 1
MikeLSS
Level: Powered On

Re: Assign only unique numbers to items using ForAll and Patch

Actually, I found a solusion by myself.

FYI here:

 

I made another collction collecting the used Unique numbers, then removed duplicated numbers from the 1st collection with the used Unique numbers.

 

ClearCollect(CasNumUsed,ShowColumns(Filter(Reservation_Record,And(R_Date > DatePicker1.SelectedDate-1, R_Date < DatePicker1.SelectedDate + 1)),"Cashier_Num2"));
RemoveIf(CasNumOption,Cashier_Num1 exactin CasNumUsed.Cashier_Num2);

View solution in original post

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 (6,607)