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

Need to create a primary key for a form and items in gallery

I have a form and a gallery. Form have two fields and gallery have three columns but could have one or more rows in it. 

Using for all I am saving the form and gallery data in one SharePoint list. Now i need to create one column in share point  list (which is unique) so that I can retrieve all this data at once. If we consider this as a record being saved from power apps to SharePoint. One record can have any no of values in it. One record could have 5 and another could have 11. But should have only one Id. So that using this Id I can retrieve respective Data. How can I create this unique id while saving.

gallery.PNG

eg: Name Sex(Form)               Subject       Marks       Date (Gallery)

      David Male                        Maths         90            20/20/20

                                                Physics        80            10/10/10

                                               science        10              10/10/10

The above data should have one id created in Share Point so that it can be retrieved once.

     

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
v-yujincui-msft
Community Support
Community Support

Hi @Rajesh456 ,

 

Maybe you could consider creating a custom ID column.

1. Here is my SharePoint list.

vyujincuimsft_0-1653463460461.png

2. Here is my App.

Set(cid,Text(Now(),"yyyymmddhhmmss"));
Filter(datasource,StartsWith(CustomID,TextInput1.Text))

vyujincuimsft_2-1653463851059.png

Result Screenshots:

vyujincuimsft_3-1653463926439.png

vyujincuimsft_4-1653463943434.png

 

 

Best Regards,

Charlie Choi

View solution in original post

v-yujincui-msft
Community Support
Community Support

Hi @Rajesh456 ,

 

The LookUp() function finds the first row of records in a table that satisfies a formula.

Maybe you could try the following formula:

UpdateIf(Complete_data,PDFNumber=PDFno,{PDFStatuses:PDFStatus})

 

Best Regards,
Charlie Choi

 

View solution in original post

5 REPLIES 5
Drrickryp
Super User
Super User

@Rajesh456 

SharePoint lists automatically create an ID when a new record is added.  Although it may be hidden in the SharePoint list seen within SharePoint, it can be referenced and used in PowerApps.  To see it, you just need to add a label to your gallery and make its Text property ThisItem.ID

To identify a row in the gallery from a form, the Item property of the form can be

Lookup(SPlist, ID=Gallery1.Selected.ID)

@Drrickryp @But for all the items I saved once it need to have only one ID. In one save button if I am pushing 5 rows in to share point all the five need to have the same ID. ID column in share point is giving 5 different id's.

v-yujincui-msft
Community Support
Community Support

Hi @Rajesh456 ,

 

Maybe you could consider creating a custom ID column.

1. Here is my SharePoint list.

vyujincuimsft_0-1653463460461.png

2. Here is my App.

Set(cid,Text(Now(),"yyyymmddhhmmss"));
Filter(datasource,StartsWith(CustomID,TextInput1.Text))

vyujincuimsft_2-1653463851059.png

Result Screenshots:

vyujincuimsft_3-1653463926439.png

vyujincuimsft_4-1653463943434.png

 

 

Best Regards,

Charlie Choi

Rajesh456
Frequent Visitor

Thanks @v-yujincui-msft .
In the same way for this customer id 1 I am giving a status as "Draft" and on click of another button I need to change the Status to "Closed".
I am able to get Draft for all the necessary records but changing them to Closed is not being done.
With the below code I am only able to change the status for one row but I need the changes for all the rows in one record.
Set(PDFno,Concatenate("PDF-",Text(Now(),"[$-en-US]yymmddhhmmss")));
Set(PDFStatus,"Closed");
Patch(Complete_data,LookUp(Complete_data,PDFNumber=PDFno),{PDFStatuses:PDFStatus});//PDFStatuses consists of 5 rows with same Status Draft of PDFNumber.
Now all these 5 rows should become Closed onclick of submit

v-yujincui-msft
Community Support
Community Support

Hi @Rajesh456 ,

 

The LookUp() function finds the first row of records in a table that satisfies a formula.

Maybe you could try the following formula:

UpdateIf(Complete_data,PDFNumber=PDFno,{PDFStatuses:PDFStatus})

 

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.

Top Solution Authors
Top Kudoed Authors
Users online (2,790)