cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Condition to Set Button to Disabled

Not sure why this isn't working.

 

If the content of Gallery 'Unique ID' field equals any entry in UnqID field of MemberList set button to DisplayMode.Disabled else Edit. 

 

If(NewMemberGalleryUniqueIDFld.Text = MemberCollection.UnqID,true, Disabled,Edit)

 

3csman_0-1612920707781.png

 

9 REPLIES 9
Eelman
Super User
Super User

@Anonymous 

Use this

 

If(
   NewMemberGalleryUniqueIDFld.Text = MemberCollection.UnqID,
   DisplayMode.Edit,
   DisplayMode.Disabled
)
Anonymous
Not applicable

Doesn't like that either.

 

3csman_0-1612922374357.png

 

I suspect you are trying to compare different data types, hence the redlined '=' operator.

 

If MemberCollection.UnqID data type is a number then try wrapping your NewMemberGalleryUniqueIDFld in the Value() function, ie

 

Value(NewMemberGalleryUniqueIDFld.Text)
Anonymous
Not applicable

Same result.

3csman_0-1612922896017.png

 

What is the error? Have you tried doing some basic error checking yourself?

Anonymous
Not applicable

'Invalid argument type'

 

Yes, I have I tried to edit it several times, without success.

 

Assumed what you provided was the solution.

Unfortunately, I cannot see your data types, it's up to you to share those.

 

So, back to the original question,

1. Are you adding this code onto the DisplyMode of the button?

and

2. Are you checking NewMemberGalleryUniqueIDFld.Text against a single value (because this is what I assumed your condition was doing based on the code you supplied) ... OR ... is it being checked against a LIST OF ITEMS to see if it existing in that list. If the latter, then there is more to do with your code than a simple comparison check.

Anonymous
Not applicable

I tried to type this in the reply and kept getting a bad html text error for some reason. This is a Word cut a paste.

 

3csman_2-1612934696830.png

 

What type of data sources are MemberList and MemberCollection? Are they in app collections or some external source?

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,283)