web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Need to create a prima...
Power Apps
Answered

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

(0) ShareShare
ReportReport
Posted on by 18

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.

     

 

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @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)

  • Rajesh456 Profile Picture
    18 on at

    @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.

  • Verified answer
    v-yujincui-msft Profile Picture
    on at

    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 Profile Picture
    18 on at

    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

  • Verified answer
    v-yujincui-msft Profile Picture
    on at

    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

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard