cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GauravG
Continued Contributor
Continued Contributor

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
RandyHayes
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 below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

5 REPLIES 5
RandyHayes
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 below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

GauravG
Continued Contributor
Continued Contributor

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 below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes
GauravG
Continued Contributor
Continued Contributor

@RandyHayes Please ignore this question, it's working as expected. Was a temporary glitch i think. Thanks

.........................................IGNORE BELOW...................................................

This old formula stopped working.

I actually deleted this datacard- 'Latest Version Number' by mistake and so not trying to redo- what you had suggested in this post long back.

 

The issue is that it keeps on saying formula is incorrect and doesn't show "DEFAULT" property of parent available for selection. Is there another way or am i doing it wrong again?

GauravG_0-1610883022854.png

If the New Report/ Version toggle is ON, the value saved for Latest Version number, which would be a hidden field' should increase by 1

RandyHayes
Super User III
Super User III

@GauravG 

That was an easy one for me 😂

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

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

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 (53,389)