cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sharuk
Helper V
Helper V

Value(negative number) showing greater than zero

Hi,

I'm having number field where i was checking the requested tickets are greater than available and showing error as shown below:

 

If(
(DValue_TRequest.Selected.Value = "General" && Value(GTickets.Text) > Value(A_GenTickets.Text)) || (DValue_TRequest.Selected.Value = "VIP" && Value(VIPTickets.Text) > Value(A_VIPTickets.Text)),
"Requested tickets are more than available tickets",
Blank()
)

 

But, when i try to enter -1 in requested where the available is 0, it is not throwing any error ? am i doing any wrong here ?

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Please try:

The key is that 0 is indeed greater than -1. According to the logic of your formula, no error will be reported.

So,I suggest you add a judgment condition "check whether the inventory is less than or equal to 0",For example:

 

If(
   (

     DValue_TRequest.Selected.Value = "General" &&

     (Value(GTickets.Text) > Value(A_GenTickets.Text) || Value(A_GenTickets.Text)<=0 )

   )||

   (

      DValue_TRequest.Selected.Value = "VIP" &&

      (Value(VIPTickets.Text) > Value(A_VIPTickets.Text) || Value(A_VIPTickets.Text)<=0)

    ),

"Requested tickets are more than available tickets",
Blank()
)

 

Best Regards,

Bof

View solution in original post

2 REPLIES 2
gabibalaban
Dual Super User
Dual Super User

Hi @Sharuk ,

If DValue_TRequest a combobox control ? Have you select a value for this control before you get this behavior ?

Sincerily I prefer for combobox:

First(DValue_TRequest.SelectedItems).Value

 

Hope it helps !

v-bofeng-msft
Community Support
Community Support

Please try:

The key is that 0 is indeed greater than -1. According to the logic of your formula, no error will be reported.

So,I suggest you add a judgment condition "check whether the inventory is less than or equal to 0",For example:

 

If(
   (

     DValue_TRequest.Selected.Value = "General" &&

     (Value(GTickets.Text) > Value(A_GenTickets.Text) || Value(A_GenTickets.Text)<=0 )

   )||

   (

      DValue_TRequest.Selected.Value = "VIP" &&

      (Value(VIPTickets.Text) > Value(A_VIPTickets.Text) || Value(A_VIPTickets.Text)<=0)

    ),

"Requested tickets are more than available tickets",
Blank()
)

 

Best Regards,

Bof

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 (2,895)