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

Storing SQL data to Collection

Really confused about how to add results from a data source to the form so that the info can be updated without affecting the actual data source.

 

Ideally I want to save a filtered SQL table to a collection. At most, it would be 5 records after the filter is applied. I see articles about saving a collection to a SQL table, but not the other way around. Is this possible? 

 

I need the info displayed, need users to be able to select and update without actually updating the data source. I don't want the updates saved back to the data source. 

 

Have tried things along the lines of ForAll(filteredDataTable, Collect(collectionName, etc)) with no luck

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Storing SQL data to Collection

Hi @kayleegoose 

You can populate a local collection from a SQL data source by using the ClearCollect function. The formula to do this would look something like this:

ClearCollect(filteredDataTable,
Filter('[dbo].[YourSQLServerTable]', YourFilterCriteria)
)

Once you do this, you can then set the Items property of a gallery control to filteredDataTable in order to display the collection data.

 

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Storing SQL data to Collection

Hi @kayleegoose 

You can populate a local collection from a SQL data source by using the ClearCollect function. The formula to do this would look something like this:

ClearCollect(filteredDataTable,
Filter('[dbo].[YourSQLServerTable]', YourFilterCriteria)
)

Once you do this, you can then set the Items property of a gallery control to filteredDataTable in order to display the collection data.

 

View solution in original post

Highlighted
Community Support Team
Community Support Team

Re: Storing SQL data to Collection

Hi @kayleegoose ,

Could you please share a bit more about your scenario?

Do you want to save your filtered SQL Table into a Collection?

 

If you want to save your filtered SQL Table into a Collection, please take a try with the following workaround:

ClearCollect(
                LocalCollection, 
                Filter('[dbo].[YourSQLTable]', FilteredColumn = "A specific value")
)

If you want to use ForAll function to achieve your needs, please modify your formula as below:

ForAll(
filteredDataTable,
Collect(
collectionName,
{
Column1: filteredDataTable[@Column1],
Column2: filteredDataTable[@Column2],
Column3: filteredDataTable[@Column3],
...
}
)
)

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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
Users Online
Currently online: 216 members 5,559 guests
Please welcome our newest community members: