cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Hiding data cards based on drop-down selection at start of edit form

I have a survey form that contains a drop down containing a list of customers. This list is drawn from a different sharepoint list than the list that the form submits to. This list of customers also has columns containing the names of the services we deliver, and where a customer is taking that service from us, there is a YES/NO (in boolean True/False) entry that can selected.

 

The survey form contains two questions per service, for all the services we provide, each with question has its own data card. I would like the edit form to hide all the questions relating to services that the customer is not taking when that customer is selected from the dropdown at the start of the form. I'll also need to do the same for the view form.

 

We have approximately 80 services so any solution needs to be able to scale to this without crazy huge formulas.

 

I'm pretty new to Powerapps, so please be as explicit as you can with any suggestions. Many thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: Hiding data cards based on drop-down selection at start of edit form

I've figured it out, and what was necessary was to nest a lookup inside the IF function.

The formula looks like this:

 

Visible = If(LookUp(Customers,Customer_Name = DDCustomer.Selected.Value, Service_Name), true, false)

View solution in original post

11 REPLIES 11
BrandonMcG
Level: Powered On

Re: Hiding data cards based on drop-down selection at start of edit form

It sounds like you could check the value of the Dropdown, and set the visible property on the data card with an If() statement.

 

DataCard1.Visible = If(Dropdown1.Selected.Value="NO",false,true)
Anonymous
Not applicable

Re: Hiding data cards based on drop-down selection at start of edit form

Can you expand on what you mean by 'check the value of the dropdown' please? Do you mean by using the formula/expression that you've supplied, or by some other means?

 

This

DataCard1.Visible = If(Dropdown1.Selected.Value="NO",false,true)

 

Really needs to be this

DataCard1.Visible = If(Dropdown1.selected.value=Customerlist.customername && datacard1.displayname=customerlist.service1.value=true,tru,false)

i.e. datacard1 is visible if the customer selected in the dropdown has a value of 'true' in the service name column of the same name as the display name of the data card.

 

The thing is, I don't know what commands to use, what sytax to use, or how to make it dynamic, i.e. you pick another customer from the drop down at the start of the form and the rest of the form hides or unhides the data cards as appropriate for the new customer that's been selected.

Highlighted
BrandonMcG
Level: Powered On

Re: Hiding data cards based on drop-down selection at start of edit form

Bookmark this link - https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/formula-reference - as it's something you'll reference quite often. That will help you with commands/syntax for the forumlas.

 

Powerapps is inherently dynamic meaning DataCard1.Visible will be true or false, based on the Dropdown1.Selected.Value matching what you want to make it visible.

 

DataCard1.Visible = 
If(
  Dropdown1.Selected.Value="YOUR VALUE",
    true,    // this sets your visibility to true if the value matches
    false    // this sets your visibility to false if the value doesn't match
)

 

Check out this tutorial which will help you understand a little better how PowerApps works. https://docs.microsoft.com/en-us/powerapps/guided-learning/get-started

Anonymous
Not applicable

Re: Hiding data cards based on drop-down selection at start of edit form

Thanks, I've been using that list as a reference, it is indeed pretty handy.

 

Do you have any advice on how to look up whether a customer has a true or false value in a column in a list in which the customer appears as a list item, and how to use that value to show or hide the data card?

 

I can easily write a basic 'if' statement to show a data card based on the drop down, it's the looking up of a secondary value that I have no idea how to do.

BrandonMcG
Level: Powered On

Re: Hiding data cards based on drop-down selection at start of edit form

- What are the names of the controls?

- What is the condition? ie... if x = y

- What do you expect to happen if it's true?

 

 

Anonymous
Not applicable

Re: Hiding data cards based on drop-down selection at start of edit form

For the sake of simplicity, lets say there are two controls on the edit form: DDCustomer, and Service1FeedbackText. These sit on DataCard_1 and DataCard_2 respectively.

 

The source for the DDCustomer drop down is another sharepoint list named 'Customer_List', using the column named Customer_Name. The format of the customer list is the first column contains the customer name and subsequent columns are named 'Service_1', 'Service_2' etc etc. These columns are a yes/no choice that is made when the customer is added as a line item to the list.

 

The edit form needs to show DataCard_2 based on whether the Customer that has been selected in DDCustomer has Service_1 set as true(yes) or false(no) in the customer list.

 

So if the selected customer has the service set to 'true' in the customer list, datacard_2 will be visible, otherwise it will be hidden.

BrandonMcG
Level: Powered On

Re: Hiding data cards based on drop-down selection at start of edit form

I'm getting lost with the column names. A dropdown doesn't necessarily care about column names, just the Selected.Value (which would be the data in whatever the column name is)

 

What does the DDCustomer.Selected.Value give you?


DataCard1.Visible =  If(DDCustomer.Selected.Value="YES",true,false)

Anonymous
Not applicable

Re: Hiding data cards based on drop-down selection at start of edit form

The DDCustomer.selected.value gives you the customer name from the customer list.

 

 

Your if statement DataCard1.Visible =  If(DDCustomer.Selected.Value="YES",true,false) will make datacard1 visible if there is a value in the DDcustomer.selected.value that is "YES".

 

I need that expression to make Datacard1 visible if the DDcustomer.Selected.Value is a customer that has a service that the customer list indicates that customer is taking, that also matches a property that identifies the Datacard1.

Anonymous
Not applicable

Re: Hiding data cards based on drop-down selection at start of edit form

I've figured it out, and what was necessary was to nest a lookup inside the IF function.

The formula looks like this:

 

Visible = If(LookUp(Customers,Customer_Name = DDCustomer.Selected.Value, Service_Name), true, false)

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (6,165)