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

Powerapps button to action request but only if certain conditions are met

Hi all

 

I know this one is going to be easy and I feel like I'm right there but I can't quite figure out how to achieve what I'm trying to achieve.

 

I have a app that is going to record fuel purchases.

 

I have some fields that I want to be "required" before submission is allowed.

 

On top of that, I have one field that, if left blank, I want it to patch the number "0" to Sharepoint, if it has a number entered, I want it to patch that number. I know I can default this text input to zero but I'd rather not if I can help it.

 

I think I may need nested If statements but I can't figure out how to make it work after many iterations of the code.

 

The app looks like this:

 

Capture.JPG

 

And the current code is like this:

 

If(!IsBlank(RegoLabel) && !IsBlank(KMsTextInput) && !IsBlank(FuelTextInput) && !IsBlank(CostTextInput) && AdBlueTextInput.Text = "",

Patch(FuelRegister, Defaults(FuelRegister), {Driver: DriverLabel.Text, Vehicle: VehicleSelectDropdown.Selected, Rego: RegoLabel.Text, Kilometres:Value (KMsTextInput.Text),Fuel:Value (FuelTextInput.Text), AdBlue: 0.0, TotalCost:Value (CostTextInput.Text)}),

 

Patch(FuelRegister, Defaults(FuelRegister), {Driver: DriverLabel.Text, Vehicle: VehicleSelectDropdown.Selected, Rego: RegoLabel.Text, Kilometres:Value (KMsTextInput.Text),Fuel:Value (FuelTextInput.Text), AdBlue:Value (AdBlueTextInput.Text), TotalCost:Value (CostTextInput.Text)}))

 

;UpdateContext({PopUp: true})

 

This is not doing what I need it to as it will patch the second set of data if any of the first conditions are not met which isn't what I want.

 

Any help you can give me would be much appreciated.

 

Thank you 🙏

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Powerapps button to action request but only if certain conditions are met

Hi @FlowFail ,

 

Please try to modify your codes as follows, nest 'AdBlueTextInput.Text = ""' condition into the AdBlue field value part code.

 

If(!IsBlank(RegoLabel) && !IsBlank(KMsTextInput) && !IsBlank(FuelTextInput) && !IsBlank(CostTextInput) ,

Patch(FuelRegister, Defaults(FuelRegister), {Driver: DriverLabel.Text, Vehicle: VehicleSelectDropdown.Selected, Rego: RegoLabel.Text, Kilometres:Value (KMsTextInput.Text),Fuel:Value (FuelTextInput.Text), AdBlue: If(AdBlueTextInput.Text = "",0.0,Value (AdBlueTextInput.Text)), TotalCost:Value (CostTextInput.Text)}))

Hope this helps.

Sik

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Powerapps button to action request but only if certain conditions are met

Hi @FlowFail ,

 

Please try to modify your codes as follows, nest 'AdBlueTextInput.Text = ""' condition into the AdBlue field value part code.

 

If(!IsBlank(RegoLabel) && !IsBlank(KMsTextInput) && !IsBlank(FuelTextInput) && !IsBlank(CostTextInput) ,

Patch(FuelRegister, Defaults(FuelRegister), {Driver: DriverLabel.Text, Vehicle: VehicleSelectDropdown.Selected, Rego: RegoLabel.Text, Kilometres:Value (KMsTextInput.Text),Fuel:Value (FuelTextInput.Text), AdBlue: If(AdBlueTextInput.Text = "",0.0,Value (AdBlueTextInput.Text)), TotalCost:Value (CostTextInput.Text)}))

Hope this helps.

Sik

View solution in original post

Highlighted
Helper II
Helper II

Re: Powerapps button to action request but only if certain conditions are met

Thank you @v-siky-msft 

 

I knew that wasn't going to be a tough one but it had me stumped!

 

Have a good day 🙏

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

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

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,289)