cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
SeanHenderson
Level: Powered On

Disabling a Button if a Value is Less than

I keep having issues trying to disable data cards based on values in other cards, and I'm wondering if these are limitations of using custom entities in CDS as the data source. 

This time, I want to disable a card on a form if a value in another card is less than 20,000:

If(Value(RevisedCostValue.Text)<"20000", DisplayMode.Disabled,Edit)

But I get the error "Invalid arguement type. Expecting a number value."

RevisedCostValue is a Text Input in number format. There doesn't seem to be a selection for Number Box or a way to use something like RevisedCostValue.Number in my formula. This seems like a huge limitation.

1 ACCEPTED SOLUTION

Accepted Solutions
RezaDorrani
Level 10

Re: Disabling a Button if a Value is Less than

Hi @SeanHenderson 

 

If you add built in display modes for objects of card and remove the defaul parent.display mode then the parent display mode will have noimpact on them

 

One option will be to set a variable (example : var: true)

if your condition > 2000 logic then set var: false

 

then for each object in data card apply an AND operation with this var 

 

That ways it will act like a required condition for all the objects within the cards

 

 

Regards,

Reza Dorrani

 

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

8 REPLIES 8
RezaDorrani
Level 10

Re: Disabling a Button if a Value is Less than

Hi @SeanHenderson 

 

try this

 

If(Value(RevisedCostValue.Text)<20000, DisplayMode.Disabled,Edit)

 

Regards,

Reza Dorrani

 

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

SeanHenderson
Level: Powered On

Re: Disabling a Button if a Value is Less than

@RezaDorrani 

That doesn't have any errors, I feel like an idiot for missing that haha.

However it also doesn't disable the card. I've tried just creating a label (Label7) and changing the formula to :

If(Value(Label7.Text)<20000, DisplayMode.Disabled, DisplayMode.Edit)

and setting the text value of Label7 to 0. This still doesn't disable the card.

RezaDorrani
Level 10

Re: Disabling a Button if a Value is Less than

Hi @SeanHenderson 

 

Just tested same thing and it worked

 

I am assuming label text is "0"

 

Also, If(Value(Label7.Text)<20000, DisplayMode.Disabled, DisplayMode.Edit) is being applied to data card or the control within the data card?

 

SeanHenderson
Level: Powered On

Re: Disabling a Button if a Value is Less than

Yes the value in label is "0"

If I make a separate object, like a button, and apply:

If(Value(Label7.Text)<20000, DisplayMode.Disabled, DisplayMode.Edit)

Then it works.

I am applying it to the data card, not a control within the card. If I apply it to a control within the card, the control works. However, selecting these controls individually won't work as each one has their one DisplayMode properties based on other rules. I need the whole card to be in DisplayMode.Disabled under the condition of the Revised Total Cost being less than 20000, and if it is in edit mode I need all the separate rules for each object to be activated.

 

RezaDorrani
Level 10

Re: Disabling a Button if a Value is Less than

Hi @SeanHenderson 

 

all controls in data card need to have display mode set to Paren.tDisplayMode

that ways they will respect the setting of the parent data card

 

Regards,

Reza Dorrani

 

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

SeanHenderson
Level: Powered On

Re: Disabling a Button if a Value is Less than

@RezaDorrani 

So just to confirm, what I want is not possible? To have built in Display Mode rules on objects in a card that are active when the whole card is in DisplayMode.Edit, but disable the whole card based on it's own DisplayMode rule?

RezaDorrani
Level 10

Re: Disabling a Button if a Value is Less than

Hi @SeanHenderson 

 

If you add built in display modes for objects of card and remove the defaul parent.display mode then the parent display mode will have noimpact on them

 

One option will be to set a variable (example : var: true)

if your condition > 2000 logic then set var: false

 

then for each object in data card apply an AND operation with this var 

 

That ways it will act like a required condition for all the objects within the cards

 

 

Regards,

Reza Dorrani

 

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

SeanHenderson
Level: Powered On

Re: Disabling a Button if a Value is Less than

Okay, that workaround will suffice I will apply that, thank you very much for the suggestion.

 

I think I will also add this to the suggested features to let people build in layers of business rules like that.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, September 18th at 8am PDT

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 122 members 4,103 guests
Please welcome our newest community members: