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

Apply UpdateIf formula based on form's success & a toggle field

Hi Community,

Need help in using UpdateIf formula below on 2 conditions

UpdateIf(Business_Requirement_Document, Title = Title_DataCard3.Default, {'Latest Version Number':'Latest Version Number' + 1 }.Text)

 

1st condition is New Version toggle should be On

2nd condition is that form submission should be successful (OnSuccess)

 

GauravG_0-1603400633521.png

The UpdateIf formula has to change a field in the source SP list after form's submission and if this report is a new version.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

@GauravG 

You've got quite a few issues on that formula.

One is that you are first resetting the form...so all of the values you are then trying to use will be empty.

Then, UpdateIf will not return a value you can use like that.  UpdateIf will return the entire datasource as a table.  Then you are using 'Latest Version Number' + 1 - that is not a numeric value, then you are trying to get the Text value from a record...which will not work.

 

My suggestion is that you actually do everything you are trying to do with the Submit...why make another call to the datasource?

This kind of goes back to your previous post that I missed earlier.  Rather than doing the update like that, just have your Latest Version Number datacard in your form.  You don't have to have it visible, you can hide it.  Then in the Update property of the datacard, set it to the following:

If(yourToggleControlName.Value, Parent.Default + 1, Parent.Default)

 

This is a somewhat hypothetical formula as I am not 100% sure on your column types.  But the concept here is to add one to the underlying numeric column based on the toggle.

 

The advantage of this is that this will all happen in the SubmitForm.  You don't need to make another trip to the datasource in the OnSuccess.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

3 REPLIES 3
Super User III
Super User III

@GauravG 

You've got quite a few issues on that formula.

One is that you are first resetting the form...so all of the values you are then trying to use will be empty.

Then, UpdateIf will not return a value you can use like that.  UpdateIf will return the entire datasource as a table.  Then you are using 'Latest Version Number' + 1 - that is not a numeric value, then you are trying to get the Text value from a record...which will not work.

 

My suggestion is that you actually do everything you are trying to do with the Submit...why make another call to the datasource?

This kind of goes back to your previous post that I missed earlier.  Rather than doing the update like that, just have your Latest Version Number datacard in your form.  You don't have to have it visible, you can hide it.  Then in the Update property of the datacard, set it to the following:

If(yourToggleControlName.Value, Parent.Default + 1, Parent.Default)

 

This is a somewhat hypothetical formula as I am not 100% sure on your column types.  But the concept here is to add one to the underlying numeric column based on the toggle.

 

The advantage of this is that this will all happen in the SubmitForm.  You don't need to make another trip to the datasource in the OnSuccess.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

Thanks @RandyHayes , i think i would need more help!

Based on your suggestion, i tried- If(yourToggleControlName.Value, Parent.Default + 1, Parent.Default)

However, the .Value part is not coming up due to control property of Toggle

I have highlighted the control with red and in the formula bar you can see what comes up with letter 'V'

 

GauravG_0-1603403520491.png

Thanks again!

@GauravG 

You are referencing your DataCard...you need to reference (in this case) the control in your datacard.  What is the name of the toggle control?  That is what you need to reference there.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (11,010)