cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Spriinter
Frequent Visitor

Select and Show Different Column in a Gallery Depending on Dropdown Selection

I'm working on a gallery. This apps was built from a SharePoint List.

I want the label "etcTime" to switch and show contents from one of three columns, depending on selection of the dropdown "TrackStatusDataCard". I have tried below code, it didn't show mistake but nothing shows. Could anyone suggest what is going wrong?

Spriinter_0-1655471011629.png

Thank you so much!

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

@Spriinter ,

There is some bracketing wrong at the end and also a Text value - try this

With(
   {
      wSet: Text(Thisltem.'CN Est Set Time',"hh:mm"),
      wEst: Text(ThisItem.'PSA Est to Complete', "hh:mm"),
      wPull: Text(ThisItem.'CN Est Pull Time',"hh:mm"),
      wStatus: TrackStatusDataCard.Selected.Value
   },
   Switch(
      wStatus,
      "Clear",
      wSet,
      "Export",
      wEst,
      "Empties,
      wEst,
      "To Top",
      wEst,
      wPull
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

View solution in original post

7 REPLIES 7
trjackson77
Resolver I
Resolver I

Hi,

    your code is referencing the 'Selected' item in the gallery. Try:

If(ThisItem.trackstatus = "Export", ThisItem.'PSA Est to Complete',false)

No, sorry your code didn't work in my situation.

My purpose is that, e.g. when "Export" was selected from the dropdown "TrackStatusDataCard" (from an edit form on another screen), the "ectTime" label on this gallery should show "PSA Est to Complete", which is one of the columns from my SharePoint List.

WarrenBelz
Super User
Super User

Hi @Spriinter ,

There is nothing wrong with your code if: -

  • the selected item in TrackstatusDataCard is Export AND
  • ’PSA Est to Complete' is a field in the source of your gallery AND
  • it contains data in any of the records you are displaying

To test both of these parameters, put two Labels in your gallery 

TrackstatusDataCard.Selected.Value

and

ThisItem.'PSA Est to Complete'

and you should find which one is the issue

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Hello WarrenBelz,

 

Thank you for the answer, but it still not showing what I want...I'm not sure what is going wrong.

Please see below screenshot,

Spriinter_0-1655741887157.png

Now I put 2 labels, and it showed the first one, which is the code,

TrackStatusDataCard.Selected.Value

has problem. The second code works well.

I re-checked the font and color, it should be good.

 

To provide more context, here is my datasource looks like,

Spriinter_1-1655742221947.png

The "TrackStatusDataCard" was built from the list column "Track Status".

What I want to achieve is that, an "if" statement runs when "Track Status" is "Export", it shows the data in "PSA Est to Complete" column, and so on...

 

Thanks again!

 

David

Hello Again WarrenBelz,

 

So here is my latest code, please see below,

Spriinter_0-1655752824537.png

no error warning, but still doesn't show anything.

Actually this afternoon it showed once and I didn't even know why it showed, then I completed the code but nothing shows again.

 

Let me know if your idea.

 

Thank you!

 

David

Hi @Spriinter ,

Is TrackStatusCard, the Data Card or the Drop-down name? You need the drop-down.

WarrenBelz
Super User
Super User

@Spriinter ,

There is some bracketing wrong at the end and also a Text value - try this

With(
   {
      wSet: Text(Thisltem.'CN Est Set Time',"hh:mm"),
      wEst: Text(ThisItem.'PSA Est to Complete', "hh:mm"),
      wPull: Text(ThisItem.'CN Est Pull Time',"hh:mm"),
      wStatus: TrackStatusDataCard.Selected.Value
   },
   Switch(
      wStatus,
      "Clear",
      wSet,
      "Export",
      wEst,
      "Empties,
      wEst,
      "To Top",
      wEst,
      wPull
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,020)