How to creat 2 level drop down value in sharepoint list

Li, York 61 Reputation points
2024-01-12T09:59:31.8566667+00:00

Hi Guys: Here is my database in sharepoint list like below table, and I have other list, the list will use the database ,and I hope to create 2 level drop down list, when I choose product type ,it will be only A/B 2 choices, then when I click A, the product name column will only have two choice A White/A Black. I try to use look up column list, but there will be 4 choice AABB when I click it, but I just want A/B 2 choice.

Product Family Product Name
A A White
A A Black
B B Balck
B B White
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,825 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,044 questions
0 comments No comments
{count} votes

Accepted answer
  1. AllenXu-MSFT 21,046 Reputation points Microsoft Vendor
    2024-01-15T08:04:24.9933333+00:00

    Hi @Li, York,

    Please follow the below steps to achieve your requirement:

    1. Create a "Product" list. In this example, "Product Family" and "Product Name" columns are all text columns. Select the "Product Family" column and check "Group by Product Family". User's image User's image
    2. Create a "Product Family" list. Record Product Family in the Title column and create a "Product Name" text column. Keep the Product Name with blank temporarily. User's image
    3. Create your main list which is named as "T" in this example. Create look up fields "Product Family"(looks up to "Title" column of the "Product Family" list), "Product Name"(looks up to "Product" list and you need to check "Product Family" column to add an additional column). User's image User's image
    4. Go to "Product" list and click on a heading so the list only shows the heading. Then copy the URL and move the "FilterValue1=" to the end of the URL. Navigate to the "Product Family" list. Click on the "Product Name" column header and select "Column settings" and "Format this Column" in order to show the Column formatting screen. Finally, paste the URL into the JSON formatting (see code below). Remove the last value, ("A") so the $Title field is used instead of the static value. Paste in your custom edited JSON and press Save.
       {   "$schema": "https://columnformatting.sharepointpnp.com/columnFormattingSchema.json",   "elmType": "div",   
       "style": {     
       "display": "inline-block",     
       "padding": "10px 0 10px 0",     
       "min-height": "auto"   },   
       "children": [     
       {       
       "elmType": "span",       
       "style": {         
       "display": "inline-block",         
       "padding": "0 10px 0 0"       
       },       
       "attributes": {         
       "iconName": "Forward"       
       }     
       },     
       {       
       "elmType": "a",       
       "txtContent": "Show Countries",       
       "attributes": {         
       "target": "_top",         
       "href": {           
       "operator": "+",           
       "operands": [             
       "INSERT_URL_HERE",             
       "[$Title]",             
       "&FilterType1=Lookup"           
       ]         
       }       
       }     
       }   
       ] 
       }
       
    

    1111

    1. Go to "T" list and select "Customize forms". User's image In Power Apps, select the "Product Name" card and under the Advanced tab select "Unlock to change properties" to open up for edits. Depending on your specific instance the given names for components may be different, so adjust accordingly. User's image Select the DataCardValue3 (Combo Box) in the Product Name_DataCard1 (Card), and select the Items function value. Using the Filter function and the in operator we now can reference the values based in the Id from the Product Name to show the proper Title value based on the selection of the Product Family.
       Filter(Choices([@T].ProductName), Id in Filter(Choices([@T].'Product Name:Product Family'), Value = DataCardValue2.Selected.Value).Id)
       
    

    User's image

    Test result in this example:

    Product

    Hope my answer helps. Please let me know if you still have any concern.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.