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

Multiple Select in Combo Box to Batch Upload in SQL

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:

  • client-region-division-channelcategory-strategy-AT-campaign-1903

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:

  • client-region-division-channelcategory-strategy-AT-campaign-1903
  • client-region-division-channelcategory-strategy-BE-campaign-1903
  • client-region-division-channelcategory-strategy-HR-campaign-1903
  • client-region-division-channelcategory-strategy-NO-campaign-1903

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.

 

Thank you

 

2 REPLIES 2
Community Support
Community Support

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]',
Defaults('[dbo].[database]'),
{
AdvertiserName: AdvertiserName_DCM.Text,
CampaignName: Concatenate("client-region-division-channelcategory-strategy-", Value, "-campaign-1903"), /* <-- Concatenate CampaignName Text based on the Value from ComboBox1.SelectedItems */
Placement_x0020_Name: PlacementName.Text,
...
} ) )

More details about ForAll function in PowerApps, please check the following article:

ForAll function

 

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.

Hi @v-xida-msft,

 

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:

  • client-client-client-client-region-region-BE-creative type-1212
  • client-client-client-client-region-region-BE-creative type-1212
  • client-client-client-client-region-region-BE-creative type-1212
  • client-client-client-client-region-region-BE-creative type-1212

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?

 

Thanks,

Mammoth

 

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 (13,040)