cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Newbie12
Helper IV
Helper IV

patch record based on condition in powerapps

Hi,

 

My Datasource is Excel,which contains columns "Ref No","Cancel Reservation","Cancel Reason","Current Status" & "Steps". I have Gallery on my Screen,which contains "Ref No" and other information. When User Clicks on their desired "Ref No", it navigates them to the form (Edit Mode), which consists of "Cancel Reservation","Cancel Reason","Current Status" & "Steps". I used visible property of the datacard such that when User Selects "Y" from "Cancel Reservation" datacard it display them "Cancel Reason" and "Current Status" datacard. When User Selects "N", it displays them "Current Status" and "Steps" datacard. I would like to patch my form based on User selection. Ex. If User selects "Y" under Cancel Reservation, then the data that need to be patch are for columns "Cancel Reason" and "Current Status". If User selects "N", then "Current Status" and "Steps" column should be patch to the Excel. I am not sure if something like this is possible ?

 

The "OnSelect" of  Submit button is set to Submitform(form1).

 

Thanks in advance for your time!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Newbie12 ,

There are other workarounds for this including conditional Update properties on Cards and using Combo boxes, which do not have a value in them unless you select it, however going with the Patch (and Excel causes some limitations here), if you put a button in a Custom Card on the form, you would do something like this OnSelect

If(
   YourCancelReservationDD.Selected.Value="Y",
   Patch(
      YourTableName,
      ThisItem,
      {
         'Cancel Reason':YourCancelReasonBox.Text,
         'Current Status':YourCurrentStatusBox.Text
      }
   ),
   Patch(
      YourTableName,
      ThisItem,
      {
         'Steps':YourStepsBox.Text,
         'Current Status':YourCurrentStatusBox.Text
      }
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

4 REPLIES 4
WarrenBelz
Super User III
Super User III

Hi @Newbie12 ,

One question first - why are you needing to do this when SubmitForm() will send the required data -it there is nothing in the other fields, then nothing will be updated in them (the visibility of a card does not affect its operation in Update).
You can certainly do a conditional Patch based on the selection.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @WarrenBelz ,

 

Whenever, I select "N" under Cancel Reservation, and add data to Current Status and Steps columns. It also add data from "Cancel Reason" column. "Cancel Reason" contains dropdown items such as "System Issue","Connectivity Issue","Other" etc.

Hi @Newbie12 ,

There are other workarounds for this including conditional Update properties on Cards and using Combo boxes, which do not have a value in them unless you select it, however going with the Patch (and Excel causes some limitations here), if you put a button in a Custom Card on the form, you would do something like this OnSelect

If(
   YourCancelReservationDD.Selected.Value="Y",
   Patch(
      YourTableName,
      ThisItem,
      {
         'Cancel Reason':YourCancelReasonBox.Text,
         'Current Status':YourCurrentStatusBox.Text
      }
   ),
   Patch(
      YourTableName,
      ThisItem,
      {
         'Steps':YourStepsBox.Text,
         'Current Status':YourCurrentStatusBox.Text
      }
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

@WarrenBelz. Thank you!

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

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

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

Top Solution Authors
Top Kudoed Authors
Users online (40,413)