cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
abieba
Helper III
Helper III

Number Value Comparison

Hello Guys/@yashag2255,

 

I have an issue with data comparison

 

Visibility property for (errormessage)

If(Value(DataCardValue9.Text) > Value(compassionateleavebalance.Text),true, false )

 

in app testing it works well, but when published it does not work well, the error message displays when any digit is typed into the (DatacardValue9.Text) field even if it is actually less than the DataCardValue9.

Please help  guys


 

13 REPLIES 13

@abieba 

That means you are comparing a Number to something else (e.g. Text) in your If statement.  Try putting SickLeaveBalance inside a Value() function

 

If you want to see what the collection looks like during troubleshooting just put it in a Data Table temporarily.  Similarly you can put the Set variables in Labels temporarily.  Just to see their values.

Hi @mdevaney 

 

the values are correct in the data table the 4ilters are correct too.

but when i call the SickLeaveBalance into a label i get and error saying the datatype is Table, expected text value

@abieba 

I made a mistake in my code earlier on and now I've been able to test.  Here's what you should put in the OnStart property.  Remove the FIRST function from COLLECT and then put it in each of the SET functions as shown below.

 

Collect(LeaveBalances,Filter('Leave Balance List','Staff Name'.Email = CurrentUserEmail));
Set(AnnualLeaveBalance,First(LeaveBalances).'Annual Leave Balance');
Set(SickLeaveBalance,First(LeaveBalances).'Sick Leave Balance');
Set(CompassionateLeaveBalance,First(LeaveBalances).'Compassionate Leave Balance');

 

Now all of your SET varaibles will be data type text.

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

View solution in original post

v-xida-msft
Community Support
Community Support

HI @abieba ,

Could you please share a bit more about your scenario?

Do you mean that the data value comparison does not work when running the published app?

 

Based on the issue that you mentioned, I have made a test on my side, and don't have the issue that you mentioned.

 

Please consider modify your formula as below (set the Visible property of the error message Label to following):

 

If(
Value(DataCardValue9.Text) - Value(compassionateleavebalance.Text) > 0,
true,
false
)

or

 

If(
   Value(Trim(DataCardValue9.Text)) - Value(Trim(compassionateleavebalance.Text)) > 0,
   true, 
   false
)

Please also consider take a try with above solution, check if the issue is solved.

 

If the issue still exists, please consider re-create a new app, then try above formula again, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (26,672)