cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MiniMe83
Helper III
Helper III

Hide / Unhide fields based on text input in another field

Hi,

 

I believe this should be a simple one but I cant seem to make this work. I have a single line field named "QTY" which will have a number entered ranging from 1 to 12.

 

Depending on that number, it will then show the relevant number of fields to then be populated with text describing the item. 

 

Example:

 

QTY = 3

 

Item 1: Description text (entered by user)

Item 2: Description text (entered by user)

Item 3: Description text (entered by user)

 

 

In "Item 1:" visible options, I have the following: If("3" in DataCardValue7.Value,true,false)........ but no joy when 3 is entered in the QTY field. 

 

Would it also be possible as I move down the item number description fields, that not just a specific number unhides the field but a range of numbers instead.

 

Any help will be appreciated!!!

 

TIA 🙂

 

 

17 REPLIES 17

@MiniMe83 ,

Happy to help - please repeat this post as a new thread and tag me a the top and I will respond - although the first part sounds a bit strange.

@WarrenBelz 

 

Could I have more than 1 datacard controlling the visibility of another set of datacards on one form using the same method as you mentioned?

 

For instance, I’ve done what you have suggested last time we spoke by using vQty>0 in the visibility of the fields I want to hide or show depending on the number entered into a certain datacard field, put UpdateContext({vQty:Value(mydatacard)}) into the OnChange field of the controlling datacard and added UpdateContext({vQty:0}) to the OnVisible section of the screen.

 

Could I change the vQty naming convention for something else?

 

Thanks for your help!!

Hi @MiniMe_83 ,

Yes you could in concept do that, but obviously use another variable name.

@WarrenBelz 


Are there any restrictions to variables name? Say, I would like to use C1Qty in place of vQty? Would this potentially work? Obviously I would need to repeat the process with the variable name being added to other sections of the app.

 

Thanks for replying 

Hi @MiniMe_83 ,

You can call variables whatever you want except the names of existing fields, items forms etc or Reserved command words, so C1Qty will be fine.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

@WarrenBelz 

 

So it looks like it can't handle two setups that are pretty similar on the same screen...

In the OnVisible of the screen I have: UpdateContext({C1Qty:0}); UpdateContext({vQty:0}) - It seems the first "UpdateContext" always works but the 2nd never gets completed. I've removed and swapped them around and not changing anything else and they work fine, providing they're first inline or just on their own.

 

Am I missing something?

 

Thanks 

@WarrenBelz  - Ive also tried: UpdateContext({vQty:0, C1Qty:0}).......😕

Hi @MiniMe_83 ,

There is no reason 

 

UpdateContext(
   {
      C1Qty:0,
      vQty:0
   }
)

 

would not set both of these variables. 
What exactly are you trying to do with the first one?

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (14,480)