web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Show or Hide datacards...
Power Apps
Unanswered

Show or Hide datacards based on a number entered into a text field.

(0) ShareShare
ReportReport
Posted on by 1,360
Hello,
I have this situation and would like to know if this is possible in Power Apps.

I am setting a variable (varShow) when the fields change property is set to a number between 1 and 6 
 
If(DataCardValue62.Text = "1", Set(varShow,true)); If(DataCardValue62.Text = "2", Set(varShow,true)); If(DataCardValue62.Text = "3", Set(varShow,true)); If(DataCardValue62.Text = "4", Set(varShow,true)); If(DataCardValue62.Text = "5", Set(varShow,true)); If(DataCardValue62.Text = "6", Set(varShow,true)); 

For each field in the top row I set the visible property as follows.
If(DataCardValue62.Text="",false,If(DataCardValue.Text = "1",varShow))
The visible property for the next row would be the same if "2" is entered and so on.
 
 

Number of Obligations 

1 - 6 

 

Obligor Number 1 

Obligation Number 1 

New Maturity 1 

Obligor Number 2 

Obligation Number 2 

New Maturity 2 

Obligor Number 3 

Obligation Number 3 

New Maturity 3 

Obligor Number 4 

Obligation Number 4 

New Maturity 4 

Obligor Number 5 

Obligation Number 5 

New Maturity 5 

Obligor Number 6 

Obligation Number 6 

New Maturity 6 

 

Depending on the number of obligations show that number of rows. 
So, if 1 is entered, show only the top row; if 2 is entered, show the first and second rows; if 3 is entered, show the third row, and so on. 
How can I make this happen in my power app. 
 
Thank you! 

Categories:
I have the same question (0)
  • Suggested answer
    Nandit Profile Picture
    1,568 Moderator on at
     
    You have not mentioned the control you are using to display these rows. Are you using a Form?
    Assuming your fields are connected to SharePoint columns.
     
    You can set a variable on the OnChange Property.
    I am using a Classic Text Input Control with Format set to Number:
    Set(varRowsNum, Self.Text)
    In your Form, 
    On the first set of fields, use the following code in the Visible property:
    (Value(varRowsNum) = 1 || Value(varRowsNum) < 6) && !IsBlank(varRowsNum) && !(Value(varRowsNum) = 0)
    On the second set of fields, Visbile propery would be:
    (Value(varRowsNum) = 2 || Value(varRowsNum) < 6) && !IsBlank(varRowsNum) && !(Value(varRowsNum) = 0 ||Value(varRowsNum) = 1)
    This is how it will look:
     
    If you are not using a form, you have the above table stored somewhere and you just want to display data based on the number entered in the Text Input. 
    I have created a collection to mimic your data. 
     
    Add a gallery to the screen with the following in the Items:
    FirstN(DataSource, varRowsNum)
    This is how it will look:
     
    Do share if you are using something else. more than happy to assist.
     
    Hope this helps. 
     
    Kind regards,
    Nandit
     
    If this answers your query, please mark this response as the answer.
    If its helpful, please leave a like. Thanks!

     
  • golfnutt82 Profile Picture
    1,360 on at
    Hello Nandit,
    Thank you for your reply.

    so, for each datacard in the row I only have to change (Value(varRowsNum) = 1 or 2 or 3 or 4 to display the next row that matches the variable?

    #3
    (Value(varRowsNum) = 3 || Value(varRowsNum) < 6) && !IsBlank(varRowsNum) && !(Value(varRowsNum) = 0 ||Value(varRowsNum) = 1)
    
    #4
    (Value(varRowsNum) = 4 || Value(varRowsNum) < 6) && !IsBlank(varRowsNum) && !(Value(varRowsNum) = 0 ||Value(varRowsNum) = 1)
  • Verified answer
    golfnutt82 Profile Picture
    1,360 on at
    Ok, I was able to figure this out.

    I used the variable varRowsNum in the OnChange event for the datacard.

    If "1" is chosen from the Number of Obligations
    If(varRowsNum = "1",true) && varTabSelected=6 || If(varRowsNum = "2",true) || If(varRowsNum = "3",true) || If(varRowsNum = "4",true) || If(varRowsNum = "5",true) || If(varRowsNum = "6",true) && varTabSelected=6
     
    If "2"
    If(varRowsNum = "2",true) || If(varRowsNum = "3",true) || If(varRowsNum = "4",true) || If(varRowsNum = "5",true) || If(varRowsNum = "6",true) && varTabSelected=6
     
    If "3"
    If(varRowsNum = "3",true) || If(varRowsNum = "4",true) || If(varRowsNum = "5",true) || If(varRowsNum = "6",true) && varTabSelected=6
     
    If "4"
    If(varRowsNum = "4",true) || If(varRowsNum = "5",true) || If(varRowsNum = "6",true) && varTabSelected=6
     
    If "5"
    If(varRowsNum = "5",true) || If(varRowsNum = "6",true) && varTabSelected=6
     
    If "6"
    If(varRowsNum = "6",true) && varTabSelected=6
  • Suggested answer
    SaiRT14 Profile Picture
    1,990 Super User 2025 Season 2 on at
    // General formula for showing or hiding datacards
    If(
        Value(varRowsNum) >= ThisItem.Number && varTabSelected = 6,
        true,
        false
    )

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard