cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Grootbaas
Level: Powered On

Dropdown add row in excel

Good day.

 

I am new to Powerapps and have been able to build an APP, but only to realise it is not that user friendly as I would like it to be.

 

I want to have a total of 5 dropdown lists in the EditForm. Each dropdown needs to be in a relationship with the corresponding Amount Label.

 

Something like this:

 

 Depiction of the APP Edit.Mode below:

Dropdown1

 

Amount1

 

RES

 

3

 

 

  

 

Dropdown2

 

Amount2

 

WF

 

5

 

 

  

 

Dropdown3

 

Amount3

 

INH

 

10

 

 

  

 

Dropdown4

 

Amount4

 

"Nothing
selected"

 

0

 

 

  

 

Dropdown5

 

Amount5

 

"Nothing
selected"

 

0

 

 

  

 

SampleDate

 

CompanyName

 

1/01/1900

 

XXXX

 

 

  

 

SiteName

 

ConsultantName

 

YYYY

 

ZZZZ

 

 

  

 

 

EstimatedPostage

 

 

 

2/01/1900

 

 

 

 

 

 

 

  Excel Spreadsheet being populated with the APP when the user adds it in the APP

SampleDate

CompanyName

SiteName

EstimatedPostage

ConsultantName

ContaminantSampled

SampleAmount

1/01/1900

XXXX

YYYY

2/01/1900

ZZZZ

RES

3

1/01/1900

XXXX

YYYY

2/01/1900

ZZZZ

WF

5

1/01/1900

XXXX

YYYY

2/01/1900

ZZZZ

INH

10

 

 

How do I get each dropdown to create an entry in excel per selected contaminant?

 

Thanks for the help.

PowerApps Staff Rank CarlosFigueira
PowerApps Staff

Re: Dropdown add row in excel

You can call the Patch function multiple times, one for each dropdown that has a corresponding value greater than 0. Assuming that the AmountX values are entered in text input controls (called AmountTextInput[1-5]), the SampleDate is entered in a Date Picker control (named SampleDatePicker), and the [Company/Site/Consultant] names are entered in text input controls (named [Company/Site/Consultant]NameTextInput), then you can have this formula (where 'ExcelTableName' is the name of your Excel table):

If(Value(AmountTextInput1.Text) > 0,
  Patch(
    'data source name',
    Defaults('data source name'),
    {
      SampleData: Text(SampleDatePicker.SelectedDate, "dd-mm-yyyy"),
      CompanyName: CompanyNameInputText.Text,
      SiteName: SiteNameInputText.Text,
      ConsultantName: ConsultantNameInputText.Text,
      ContaminantSampled: Dropdown1.Selected.Value,
      SampleAmount: AmountTextInput1.Text
    }));
If(Value(AmountTextInput2.Text) > 0,
  Patch(
    'data source name',
    Defaults('data source name'),
    {
      SampleData: Text(SampleDatePicker.SelectedDate, "dd-mm-yyyy"),
      CompanyName: CompanyNameInputText.Text,
      SiteName: SiteNameInputText.Text,
      ConsultantName: ConsultantNameInputText.Text,
      ContaminantSampled: Dropdown2.Selected.Value,
      SampleAmount: AmountTextInput2.Text
    }));
... If(Value(AmountTextInput5.Text) > 0, Patch( 'data source name', Defaults('data source name'), { SampleData: Text(SampleDatePicker.SelectedDate, "dd-mm-yyyy"), CompanyName: CompanyNameInputText.Text, SiteName: SiteNameInputText.Text, ConsultantName: ConsultantNameInputText.Text, ContaminantSampled: Dropdown5.Selected.Value, SampleAmount: AmountTextInput5.Text }))
Community Support Team Rank
Community Support Team

Re: Dropdown add row in excel

Hi @Grootbaas,

 

Thanks for posting.

If here you would like to use Form control to create three records, then it is not possible.

 

Edited:

 

Removed improper workarounds.

 

Please follow what CarlosFigueira posted.

 

Regards,

Michael

 

Grootbaas
Level: Powered On

Re: Dropdown add row in excel

Thank you for the replies guys. I haven't had anytime to test this, as I will need to build a new APP which is gonna take some time.

 

I will give feedback as soon as I have tested the resolutions.

 

Thanks again for the time.

Grootbaas
Level: Powered On

Re: Dropdown add row in excel

Hi 

 

 

 

 

 

 

 

 

Community Support Team Rank
Community Support Team

Re: Dropdown add row in excel

Hi @Grootbaas,

 

The workaround that I provided earlier should have some problems, I will check it again and share it later once I solve the syntax problem.

Currently, if possible, please follow what @CarlosFigueira provided.

 

Regards,

Michael

Grootbaas
Level: Powered On

Re: Dropdown add row in excel

Will do that and give feedback.

 

Thanks.