cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tsangd
Helper I
Helper I

Datacard help

Im trying to get the useValue datacard in a form  and use it as a variable within the code below, 
HOWEVER the variable use gives me an error.  
Can someone help me. 
I want to use the useValue that the user inputs and if useValue is bigger than totalSum then Displaymode disabled.

 

With(
{Tot:Sum(BoughtTotal-UsedTotal),use:useValue},
If(
     Tot > 0,
     use <= Tot,
     SubmitForm(UseRegisterForm),
     Navigate(RecordPage),

     use > Tot,
     DisplayMode.Disabled
)
)
Please help me

1 ACCEPTED SOLUTION

Accepted Solutions
v-jefferni
Community Support
Community Support

Hi @tsangd ,

 

Could you please share more details about your scenario? Is there any screenshot of the Edit form could further explain your goal? Could you explain your logic again? Which control you are wanting to disable when useValue is bigger than totalSum, the submit button?

 

Your formula looks very incorrect that the use of If statement have several mistakes.

If function:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-if#syntax

If( Condition1, ThenResult1 [, Condition2, ThenResult2, ... [ , DefaultResult ] ] )

 

If you would like to disable the submit button when useValue is bigger than totalSum, you should set formulas on the DisplayMode of the button rather than combining to OnSelect. So, I guess, OnSelect of the button:

With(
{Tot:Sum(BoughtTotal-UsedTotal),use:useValue},
If(
     Tot > 0,
     SubmitForm(UseRegisterForm),
     Navigate(RecordPage)
)
)

 

DisplayMode of the button:

With(
{Tot:Sum(BoughtTotal-UsedTotal),use:useValue},
If(
     use > Tot,
     DisplayMode.Disabled,
     DisplayMode.Edit,
)
)

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

1 REPLY 1
v-jefferni
Community Support
Community Support

Hi @tsangd ,

 

Could you please share more details about your scenario? Is there any screenshot of the Edit form could further explain your goal? Could you explain your logic again? Which control you are wanting to disable when useValue is bigger than totalSum, the submit button?

 

Your formula looks very incorrect that the use of If statement have several mistakes.

If function:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-if#syntax

If( Condition1, ThenResult1 [, Condition2, ThenResult2, ... [ , DefaultResult ] ] )

 

If you would like to disable the submit button when useValue is bigger than totalSum, you should set formulas on the DisplayMode of the button rather than combining to OnSelect. So, I guess, OnSelect of the button:

With(
{Tot:Sum(BoughtTotal-UsedTotal),use:useValue},
If(
     Tot > 0,
     SubmitForm(UseRegisterForm),
     Navigate(RecordPage)
)
)

 

DisplayMode of the button:

With(
{Tot:Sum(BoughtTotal-UsedTotal),use:useValue},
If(
     use > Tot,
     DisplayMode.Disabled,
     DisplayMode.Edit,
)
)

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,445)