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

Conditional visibility based on whether the field letter is a "B" and based a count of characters in a text field

Hi all.   Hope you are having a wonderful day!

 

I have 2 visibility fields that need to be based on a condition.

 

1) A label with text would be hidden until the user starts entering data that does not begin with the letter "B" or "b" into field 1.

 

2) 2nd field would not allow the user to fill out any other fields or click outside of the data until 21 characters were entered into the 2nd field. 

 

I tried the Count and Len functions would not work. 

 

Thank you for the help.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Conditional visibility based on whether the field letter is a "B" and based a count of characters in a text field

Hi @Misa ,

Please try this:  (Set the label's Visible)

If(Not(StartsWith(TextInput7.Text,"B")||StartsWith(TextInput7.Text,"b")),true,false)

 

Best regards,

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

View solution in original post

6 REPLIES 6
Super User
Super User

Re: Conditional visibility based on whether the field letter is a "B" and based a count of characters in a text field

The first would be:

 

Visible= If(IsMatch(TextInput1.Text,"b",Contains) || IsMatch(TextInput1.Text,"B",Contains),true, false)

 

I'm still thinking on the second...few ways you could go.

Community Support Team
Community Support Team

Re: Conditional visibility based on whether the field letter is a "B" and based a count of characters in a text field

Hi @Misa ,

1)I assume that you want to decide a label's visible based on the data entered in a textinput.

Try this formula: (set the label's Visible)

If(StartsWith(TextInput1.Text,"B")||StartsWith(TextInput1.Text,"b"),false,true)

 

2)I'm afraid it's not supported to "not allow the user to fill out any other fields or click outside of the data" currently in PowerApps.

As anlternative way, I suggest you make other controls disabled until 21 characters were entered into the 2nd textinput.

Try this:

Set other controls' DisplayMode: 

If(Len(TextInput2.Text)>=21,DisplayMode.Edit,Disabled)

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Misa
Level: Powered On

Re: Conditional visibility based on whether the field letter is a "B" and based a count of characters in a text field

@v-yutliu-msftHello.

 

Correct but i wanted the textinput to only be visible if the datacardvalue did not start with a B. I inverted the true/false from your example above.  I was hoping that the label would be hidden until the user started typing and would appear appropriately.  I tried using Not and ! with Startswith and it did not work.  

 

Thank you again for your time.

Misa
Level: Powered On

Re: Conditional visibility based on whether the field letter is a "B" and based a count of characters in a text field

@rebeccas 

 

Thank you for your response.  Like v-yutliu-msft the result is the same.  It's still pretty awesome and i will be able to use it on another form.  

 

I would like for the label to be hidden until the user starts typing in the datacard.  

 

Thanks again for your tie as well!

Community Support Team
Community Support Team

Re: Conditional visibility based on whether the field letter is a "B" and based a count of characters in a text field

Hi @Misa ,

Please try this:  (Set the label's Visible)

If(Not(StartsWith(TextInput7.Text,"B")||StartsWith(TextInput7.Text,"b")),true,false)

 

Best regards,

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

View solution in original post

Misa
Level: Powered On

Re: Conditional visibility based on whether the field letter is a "B" and based a count of characters in a text field

@v-yutliu-msft 

 

Hi and thank you again for the response.  I was able to try the new formula using NOT and it did't work at first.  I added an ISBLANK (If(IsBlank(DataCardValue5.Text), false, If(Not(StartsWith(DataCardValue5.Text,"b") || StartsWith(DataCardValue5.Text,"B")),true, false)) and that gave me the results.

 

Thank you so much for all your help.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,045)