cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

If this then Patch

Hello,

 

I am in need of assistance on a formula. I have a form that has a unit#, Serial# and location. This data is from a excel table once the unit number is selected the other 2 fields depend on the unit number and will fill accoridly. I also want the user to be able to manually enter these fields incase the unit isnt on the excel sheet. I thought the best way to do this might be to create a toglle that when turned on shows 3 manual fields and then those fields could patch the drop down fields. Does anyone have a suggestion on how to best accomplish this? 

 

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft
Microsoft

Re: If this then Patch

Hi@J0hn,

Based on the issue that you mentioned, do you want to manually enter the three fields when the needed unit could not be found in the Excel table?

Could you please share a bit more about your scenario, is this 'Unit#' a unique value?

The user should manually enter in the three TextInputs when the user could not find the needed unit from the excel table, and patch data to the corresponding fields.

I think ComboBox could achieve your needs. If you could not find your needed unit, you could refer to the SearchText as your unit.

Therefore, the corresponding control to the 'Unit#' is a Combobox, 'Serial#' and 'Location' are general TextInputs.

I think ComboBox could achieve your needs. If you could not find your needed unit, you could refer to the SearchText as your unit. 

I have a test on my side, please take a try as below.

Set the ComboBox Items property as below:

 

Distinct(Table1,'Unit#')

 

Set the ComboBox DefaultSelectedItems property as below:

 

[ThisItem.'Unit#']

 

Set the Update property of the corresponding data card to the ComboBox as below:

 

If(IsBlank(ComboBox1.Selected.Result),ComboBox1.SearchText,ComboBox1.Selected.Result)

 

Set the Default property of the corresponding TextInput to the 'Serial#' data card as below:

 

LookUp(Table1,'Unit#'=ComboBox1.Selected.Result,'Serial#')

 

Set the Default property of the corresponding TextInput to the ''Location' data card as below:

 

LookUp(Table1,'Unit#'=ComboBox1.Selected.Result,Location)

 

Set the OnSelect property of the patch Button as below:

 

Patch(
    Table1,
    Defaults(Table1),
    {
        'Unit#': If(
            IsBlank(ComboBox1.Selected.Result),
            ComboBox1.SearchText,
            ComboBox1.Selected.Result
        ),
        'Serial#': DataCardValue5.Text,
        Location: DataCardValue4.Text
    }
)

 

Best Regards,

Qi

View solution in original post

2 REPLIES 2
Highlighted
Super User III
Super User III

Re: If this then Patch

Hi @J0hn 

I suggest that you let PowerApps create your app rather than building it on your own.  Go to make.powerapps.com and in the top of the screen, select Start from data, Excel On Line.  Make sure that your spreadsheet is saved as a table and in your OneDrive folder.  Then let PowerApps make the app for you.  It will create a three screen app with a gallery for finding the item as and forms for viewing and editing each item in your table.  It can also create a new record if the item isn't in the file. You can also customize it after it is created so that you can see how PowerApps works. build app.png

Highlighted
Microsoft
Microsoft

Re: If this then Patch

Hi@J0hn,

Based on the issue that you mentioned, do you want to manually enter the three fields when the needed unit could not be found in the Excel table?

Could you please share a bit more about your scenario, is this 'Unit#' a unique value?

The user should manually enter in the three TextInputs when the user could not find the needed unit from the excel table, and patch data to the corresponding fields.

I think ComboBox could achieve your needs. If you could not find your needed unit, you could refer to the SearchText as your unit.

Therefore, the corresponding control to the 'Unit#' is a Combobox, 'Serial#' and 'Location' are general TextInputs.

I think ComboBox could achieve your needs. If you could not find your needed unit, you could refer to the SearchText as your unit. 

I have a test on my side, please take a try as below.

Set the ComboBox Items property as below:

 

Distinct(Table1,'Unit#')

 

Set the ComboBox DefaultSelectedItems property as below:

 

[ThisItem.'Unit#']

 

Set the Update property of the corresponding data card to the ComboBox as below:

 

If(IsBlank(ComboBox1.Selected.Result),ComboBox1.SearchText,ComboBox1.Selected.Result)

 

Set the Default property of the corresponding TextInput to the 'Serial#' data card as below:

 

LookUp(Table1,'Unit#'=ComboBox1.Selected.Result,'Serial#')

 

Set the Default property of the corresponding TextInput to the ''Location' data card as below:

 

LookUp(Table1,'Unit#'=ComboBox1.Selected.Result,Location)

 

Set the OnSelect property of the patch Button as below:

 

Patch(
    Table1,
    Defaults(Table1),
    {
        'Unit#': If(
            IsBlank(ComboBox1.Selected.Result),
            ComboBox1.SearchText,
            ComboBox1.Selected.Result
        ),
        'Serial#': DataCardValue5.Text,
        Location: DataCardValue4.Text
    }
)

 

Best Regards,

Qi

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

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

Top Solution Authors
Top Kudoed Authors
Users online (6,729)