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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Query related to DataT...
Power Apps
Answered

Query related to DataTable

(0) ShareShare
ReportReport
Posted on by 6

Hi, 

In our use case scenario we have multiple drop-down selections(coming in from SQL server) and based on these selections there is a dynamically changing DataTable of records(also fetched from SQL). My query is, can we save these records from DataTable to a CDS entity or SQL server in any way. Is DataTable data read only still? If there is any alternative of saving the records from DataTable, please let me know. Thanks in advance.

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,925 on at

    I suggest you replace the Datatable with a Gallery. Then use ForAll function to send the data.

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • DevendraSingh Profile Picture
    144 on at

    Hi,

    You can use the Patch function within a ForAll to update the data table records. Following are the steps,

    • Step1: Create a collection and populate with the data from SQL server or CDS, i.e. ClearCollect(colItems, GenericList)
    • Step2: Assign the collection to data table Items property
    • Step3: On the drop-down OnSelect property filter the collection, i.e. ClearCollect(colItems, Filter(GenericList, Title=ComboBox2.Selected.Value))
    • Step4: On button submit write the formula, i.e. ForAll(colItems,Patch(GenericList,LookUp(GenericList, ID = colItems[@ID]),{Title:"your value"})); Refresh(GenericList);

    Please click Accept as Solution, if this solution solved your issue. If this post was useful, please consider giving it Thumbs Up.


    Thanks & Regards,

    Devendra Singh

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous88 ,

    Do you want to save the records in your Data Table back to your SQL Server or CDS Entity?

     

    Based on the needs that you mentioned, I afraid that the Data Table could not achieve your needs. Currently, within canvas app, you could not select multiple records from Data Table once time, you could only select single one record once time.

     

    If you want to save your Data Table records back to your SQL Server Table or CDS Entity once time, I think there is no way to achieve your needs in PowerApps currently.

     

    As an alternative solution, I think the Gallery could achieve your needs. You could consider add a Gallery in your app, set the Items property to following:

    Filter(
     '[dbo].[SQLTable]', 
     Column1 = Dropdown1.Selected.Value,
     Column2 = Dropdown2.Selected.Value,
     ...
    )

    Note: Apply same Filter formula within the Items property of Gallery as that in your Data Table.

    Then within this Gallery, you could add several Text Input controls to display the column value from your SQL Table. Set the Default property of the Text Input to following:

    ThisItem.Column1
    ThisItem.Column2

    ....

    You could also made some changes to the corresponding column through the Text Input Box directly. Outside, the Gallery, add a "Save" button, set the OnSelect property to following:

    ForAll(
     Gallery1.AllItems,
     Patch(
     'CDS Entity',
     Defaults('CDS Entity'),
     {
     Column1_Entity: TextInput1.Text,
     Column2_Entity: TextInput2.Text,
     Column3_Entity: TextInput3.Text,
     ...
     }
     )
    )

    Note: The TextInput1, TextInput2, TextInput3, ... represents the Text Input boxes in above Gallery to display column values from your SQL Table.

     

    ForAll function, Patch function

     

    More details about configuring a Gallery as a Editable GRID, please check the following video resource:

    https://www.youtube.com/watch?v=41Mpgn7svLs&t=1s

    https://www.youtube.com/watch?v=Y5G5p84mD84&t=321s

     

    Best regards,

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard