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

Insert records to SQL database

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.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Insert records to SQL database

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)
)

 

View solution in original post

3 REPLIES 3
Highlighted
Super User III
Super User III

Re: Insert records to SQL database

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)
)

 

View solution in original post

Highlighted
Frequent Visitor

Re: Insert records to SQL database

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

Highlighted
Frequent Visitor

Re: Insert records to SQL database

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?

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (9,376)