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

Adding record to an SQL table from a collection

Good day.

 

I have been trying to add records from a collection to a SQL table and have done a fair amount of reading on this but can not seem to get it to work correctly. The closest that I have gotten to a solution is the below formula. Unfortunately  it does not add the records correctly in that it adds the correct number of records but all with the data stored in the first row of the ciollection.

 

 

ForAll(
	colMerge,
		Patch(
			'[dbo].[RPT_SCH]',
			Defaults('[dbo].[RPT_SCH]'),
			{
				VVO_A:First(colMerge).A,
				VVO_B:First(colMerge).B,
				VVO_C:First(colMerge).C,
				VVO_D:First(colMerge).D
			}
		)
	)

 

 If I do not use the First() function as done here I get a message that the argument needs text but found a table.

1 ACCEPTED SOLUTION

Accepted Solutions
JaviTejada
Frequent Visitor

You need to use the new function ThisRecord (Formulas: ThisRecord, As, and Sequence | Microsoft Power Apps) that points to the actual record inside the ForAll.

 

If this answer is your better solution, please marked as "Accepted Solution"

View solution in original post

1 REPLY 1
JaviTejada
Frequent Visitor

You need to use the new function ThisRecord (Formulas: ThisRecord, As, and Sequence | Microsoft Power Apps) that points to the actual record inside the ForAll.

 

If this answer is your better solution, please marked as "Accepted Solution"

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (30,696)