cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Misa
Kudo Commander
Kudo Commander

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

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
rebeccas
Community Champion
Community Champion

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.

v-yutliu-msft
Community Support
Community Support

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.

@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
Kudo Commander
Kudo Commander

@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!

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

@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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,447)