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 / Insert records to SQL ...
Power Apps
Answered

Insert records to SQL database

(0) ShareShare
ReportReport
Posted on by 21

Hello,

 

I've just created 1 Power App with the following Run statement:

 

'PowerApp->Executestoredprocedure(V2)'.Run(Gallery1.Selected.DataLevelCode, Gallery1.Selected.AdjustmentLevelCode, Gallery1.Selected.LegalEntityCode, Gallery1.Selected.LegalEntityCurrency, Gallery1.Selected.FiscalYear, Gallery1.Selected.Period, Gallery1.Selected.TransactionCurrency, Gallery1.Selected.Value,Gallery1.Selected.Dim_GLAccount, Gallery1.Selected.Dim_CostCenter, Gallery1.Selected.Dim_LegalEntityPartner, Gallery1.Selected.Dim_TransactionType, Gallery1.Selected.PostingDescription)

 

This runs a Stored Procedure which write this data to SQL. The problem is that It writes only one line of data, but I selected more than one line.

 

For example, I selected 7 rows of data:

 

bulprosbibg_0-1593694698889.png

When I run the query only the first row is inseted (1,1,1,1,1....) into the database. Is it possible to insert all of the records (row 1 to row 7) in the database?

 

Thanks.

 

Best regards.

 

 

Categories:
I have the same question (0)
  • Verified answer
    timl Profile Picture
    37,283 Super User 2026 Season 2 on at

    Hi @bulprosbibg 

    One way to do this is to call the ForAll function.

    https://docs.microsoft.com/en-gb/powerapps/maker/canvas-apps/functions/function-forall 

    If you want to call your Flow for each item in your gallery (eg 7 times), you can use code that looks like this:

    ForAll(Gallery1.AllItems,
     'PowerApp->Executestoredprocedure(V2)'.Run(DataLevelCode, 
     AdjustmentLevelCode, LegalEntityCode, LegalEntityCurrency, 
     FiscalYear, Period, TransactionCurrency, Value,Dim_GLAccount, Dim_CostCenter, 
     Dim_LegalEntityPartner, Dim_TransactionType, PostingDescription)
    )

     

  • bulprosbibg Profile Picture
    21 on at

    You are gold! Thank you very much! For now this solved my problem!

  • bulprosbibg Profile Picture
    21 on at

    Hello @timl 

     

    This works fine, but now I have the following problem:

    When I export the data from Power BI to SQL the inserted records are only 1,000. My data is more than 10,000 rows. Maybe there is some limitation becase the integration from Power BI, I dont know. Is there any work-around?

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 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard