web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Powerapps Form - allow...
Power Apps
Unanswered

Powerapps Form - allow only negative values or positive values based on a previous field

(0) ShareShare
ReportReport
Posted on by 33

I have a canvas connected to a share point list. 

 

I want to restrict users from filling in numbered values. Say i have 2 fields. Type which is a choice selection between "Income" and "Cost". 

If they selected Income, then the only accepted value should be a negative number i.e. -500, -660 etc. 

If they selected Cost then the only accepted value should be a positive number i.e. 500

 

What would be the best way of doing this for a power apps canvas? I would want this to stick both at when they are doing a new input or when they edit an existing line. 

Categories:
  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    Hi @改善 

     

    Try this formula,

     

    Set the OnChange property to the Text input control:

     

    If(
    Type.Selected.Value = "Income" && Value(TextInput1.Text) >= 0,
    Reset(TextInput1) && Notify("Please enter a negative number", NotificationType.Error),
    Type.Selected.Value = "Cost" && Value(TextInput1.Text) < 0,
    Reset(TextInput1) && Notify("Please enter a positive number", NotificationType.Error)
    )

     

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

     

  • 改善 Profile Picture
    33 on at

    Thanks for the solution Raj, but would this work if that field is part of the form? 

     

    So both Type and Value are part of the same form, i dont have one set as a text input control. 

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @改善,

    Could you please tell me that:

    1). Type is a Choice column including "Income" and "Cost", right?

    2). Another field that you need to restrict users from filling in numbered values is a single-line-of-text column, right?

    3). Which control and which field you input number values?

     

    I think @Rajkumar_404 assumed that you have a TextInput to input number values, and you have a dropdown control to select income or cost, once you select from dropdown control, a TextInput will only allow positive or negative numbers.

  • 改善 Profile Picture
    33 on at

    Hi Qi,

     

    1) Type is a choice column yes.

    2) The other field is a number field. 

    3) The user inputs data into the numbered field. 

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard