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

Community site session details

Session Id : VbywoAu3X1qIEVzB+A92u0
Power Apps - Building Power Apps
Answered

Dropdown List Choices with Switch Statement that determines list source

Like (0) ShareShare
ReportReport
Posted on 13 Sep 2023 15:33:18 by 81

I am trying to create a dropdown list where the dataverse table source changes based on the users selection in another dropdown list.  In this case the user will select either line 1, 2 or 3.  Depending on this selection the dropdown list for bulk or blanket changes.  The problem I am having is rather than giving me the choices from the dataverse choice column. Instead, it just says [object Object].  I get the choice column options when I remove the switch statement. 

 

 

  • Verified answer
    CE-16101943-0 Profile Picture
    81 on 27 Sep 2023 at 12:02:02
    Re: Dropdown List Choices with Switch Statement that determines list source

    There were 2 parts to resolving this problem. In the OnVisible for the screen I generated this collection:

    ClearCollect(
    lineOptions,
    Table(
    {
    Line: "",
    BulkorBlanket: [""],
    Options: [""]
    },
    {
    Line: "1",
    BulkorBlanket: Choices([@'Line 1 Reference Values'].'Blanket or Bulk'),
    Options: ShowColumns('Line 1 Reference Values',"cr999_blanketorbulk","cr999_product")

    },
    {
    Line: "2",
    BulkorBlanket: Choices([@'Line 2 Reference Values'].'Blanket or Bulk'),
    Options: ShowColumns('Line 2 Reference Values',"cr999_blanketorbulk","cr999_product")
    }
    )
    )

     

    Within the Bulk or Blank Dropdown the items were populated based on the selection of the Process Line Drop Down by doing this:

    LookUp(
    lineOptions,
    Line = Dropdown_LineSelection_LOD.SelectedText.Value
    ).BulkorBlanket

  • CE-16101943-0 Profile Picture
    81 on 13 Sep 2023 at 16:03:37
    Re: Dropdown List Choices with Switch Statement that determines list source

    From what I can tell the Ungroup function in your code was the potential solution.  Unfortunately, that did not work.  The output to the list still remains [object Object]

    ce_PowerPlay_0-1694624432890.png

     

     

  • jadhav_ravi_oo7 Profile Picture
    276 on 13 Sep 2023 at 15:52:52
    Re: Dropdown List Choices with Switch Statement that determines list source

    you can take help of this code - 

    //Create a collection
    ClearCollect(
    myTable47,
    {NickName: "Redwood", People: 10, Building: "Building A"},
    {NickName: "Oak", People: 25, Building: "Building A"},
    {NickName: "Pinetree", People: 8, Building: "Building B"},
    {NickName: "Cedar", People: 15, Building: "Building B"}
    );

    ClearCollect(myMeetingRooms47,
    {info:"This is a list of meeting rooms",value: myTable47});

    //Get a table stored in a cell code
    ClearCollect(mySolution47,Ungroup(myMeetingRooms47,"value"));

    by Matthew Devaney 

     

    If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others.

     


    Thanks & Regards,

     

    Ravindra Jadhav

    Independent Consultant | Freelancer 

    +91-9146152149

    Connect Me On Different Platforms

    LinkedIn || YouTube ||Blogger ||

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!