cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Stoikryz
Frequent Visitor

Gallery and Form tied to Collection as datasource, having trouble updating records

Currently I have a Form for entering 'line items', Submit button to Collect it to the same collection, and then a Gallery to Display said collection. This is eventually Patched to SQL later in my app, however I'm having trouble editing records since I don't have a unique key in a collection.

Essentially the Form is pointing to the Collection colLineItems. Since it's not a true datasource, all of my cards are custom cards, and my submit button simply collects the values of each text box, resets the form, sets it as a New form, and sets my LineItemSelected variable to Blank(). (That variable is populated with the selected item from the Gallery)

 

The Gallery is pointing to the same Collection, however if a user wanted to edit one of those records, my collection data is too dynamic to have a unique key. I was looking into including an incremental Sequence number an a sort of temporary key, however there's a chance that those wouldn't be unique either since costs and quantities are two of my Form fields.

Any ideas? I know this is an atypical use of a collection in a Form, but surely someone has tried to create something similar to this. I'm just not sure what the best way to go about it is.

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
v-yujincui-msft
Community Support
Community Support

Hi @Stoikryz ,

 

If the incremental sequence number may also be duplicated and make it unusable, maybe you can consider using the GUID function.

https://docs.microsoft.com/en-us/power-apps/maker/canvas-apps/functions/function-guid#syntax

 

In addition, maybe you could generate a unique ID based on the current date & time(yyyymmddhhmmss)

Text(Now(),"yyyymmddhhmmss")

 

Best Regards,
Charlie Choi

View solution in original post

1 REPLY 1
v-yujincui-msft
Community Support
Community Support

Hi @Stoikryz ,

 

If the incremental sequence number may also be duplicated and make it unusable, maybe you can consider using the GUID function.

https://docs.microsoft.com/en-us/power-apps/maker/canvas-apps/functions/function-guid#syntax

 

In addition, maybe you could generate a unique ID based on the current date & time(yyyymmddhhmmss)

Text(Now(),"yyyymmddhhmmss")

 

Best Regards,
Charlie Choi

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Users online (2,442)