I've built an app that publishes different text box values into separate columns on an SQL database, when a button is pressed. Currently, each time the user fills the app and presses the button, the values go into a new row.
I am looking to use the multiple select on the combo box to batch upload values. The problem I am having is I don't know how to place the value into a separate row for each selection in the combo box.
For example, I fill out the sheet and select Austria as the market and the text box concatenates the values as:
I then press the button and the name is added.
I change Austria to Belgium, press button, new row is created with new name and client-region-division-channelcategory-strategy-BE-campaign-1903 is added.
I'm looking to select Austria, Belgium, Croatia, Norway, etc. all at once and then press the button to add them all at once on separate rows like so:
These will all be in the same column, with other filled out text box values going into their relevant columns too i.e. the placement name will be the same but added to each market (see SQLcode.PNG)
Is this possible? Any help would be greatly appreciated.
HI @Mammoth ,
Could you please share a bit more about your scenario?
How do you concatenate the Compaign Name text within your app?
Do you concatenate the Compaign Name text within your app based on the selected value within the Market ComboBox?
Further, could you please share a bit more about the formula you typed within the Default property of the Campaign Name Text Box in your Edit form?
I assume that the Compaign Name text within your app is based on the selected value within the Market ComboBox, is it true?
Based on the needs that you mentioned, I think ForAll function could achieve your needs. I have made a test on my side, please take a try with the following workaround:
Set the Items property of the Market Combo Box (ComboBox1) to following:
["Austria", "Belgium", "Croatia", "Norway"]
Set the OnSelect property of the "Submit" button to following:
ForAll( ComboBox1.SelectedItems, Patch( '[dbo].[database]',
CampaignName: Concatenate("client-region-division-channelcategory-strategy-", Value, "-campaign-1903"), /* <-- Concatenate CampaignName Text based on the Value from ComboBox1.SelectedItems */
} ) )
More details about ForAll function in PowerApps, please check the following article:
I concatenate the campaign name using the 'concatenate' function and the values from each combo box that the user can select (the first four selction boxes are drop down boxes, the last is a text input box and the rest are combo boxes).
Concatenate( ddBusiness_CamDCM.Selected.Value, "-", ddRegion_CamDCM.Selected.Value, "-", ddDivision_CamDCM.Selected.Value, "-", ddChannel_CamDCM.Selected.Value, "-", ddCategory_CamDCM.Selected.Result, "-", ddStrategy_CamDCM.Selected.Result,"-", ddMarket_CamDCM.Selected.Code, "-", ddCampaign_CamDCM.Selected.Result, "-", YYMM_CamDCM.Text)
So the ForAll function you suggested does add seperate number of campaign names for the number of markets you select. However, if I select "AT", "DE", "FR", "BE" (random order), in SQL, the campaign name populates four campaigns, but the all have BE:
I know why this is happening, I am using this formula within the ForAll and Patch functions:
CampaignName: Concatenate( ddBusiness_CamDCM.Selected.Value,"-", ddRegion_CamDCM.Selected.Value,"-", ddDivision_CamDCM.Selected.Value,"-", ddChannel_CamDCM.Selected.Value, "-", ddCategory_CamDCM.Selected.Result,"-", ddStrategy_CamDCM.Selected.Result,"-", ddMarket_CamDCM.Selected.Code,"-", ddCampaign_CamDCM.Selected.Result,"-", YYMM_CamDCM.Text )
Since BE was the last value I selected and I use ddMarket_CamDCM.Selected.Code, that's why BE is the only value to be used. I tried ddMarket_CamDCM.SelectedItems.Code and got an error.
Any idea how I can get each market in a different row, as apposed to the last market that was selected on all rows?
Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.
Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.
Featuring samples like Return to the Workplace and Emergency Response Applications
Features releasing from October 2020 through March 2021