cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

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
Highlighted
Super User III
Super User III

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
Highlighted
Super User III
Super User III

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
Community Support

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (1,795)