cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mammoth
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
v-xida-msft
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
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

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (3,119)