Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

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! 

  • Suggested answer
    SaiRT14 Profile Picture
    1,966 Super User 2025 Season 1 on at
    Show or Hide datacards based on a number entered into a text field.
    // General formula for showing or hiding datacards
    If(
        Value(varRowsNum) >= ThisItem.Number && varTabSelected = 6,
        true,
        false
    )
  • Verified answer
    golfnutt82 Profile Picture
    1,360 on at
    Show or Hide datacards based on a number entered into a text field.
    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
  • golfnutt82 Profile Picture
    1,360 on at
    Show or Hide datacards based on a number entered into a text field.
    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)
  • Suggested answer
    Nandit Profile Picture
    1,563 Super User 2025 Season 1 on at
    Show or Hide datacards based on a number entered into a text field.
     
    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!

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard