Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

"Item" selected in Screen1 to be used as 'input' in Screen2

(0) ShareShare
ReportReport
Posted on by

Hello everyone,

I have stumbled upon yet another thing I do not know in PowerApp, and thus, am here asking if anyone of you could help me.

My problem now is that in screen 1 "project list" I have a list of all the projects an user has items on:

multiScreen1_forum.png

From that one, I select one and I will want for my browse screen to show it with "project 2" as the one selected, for example. The problem is I do not know how to link that the selected value there will show as the one I see on the browse screen.

multiScreen2_forum.png

So here instead of seeing all the items of "project1" and the dropdown list have selected "project1", I would want to have it selected on "project2". Due to the way the droplist and gallery are coded:

- Droplist:

Distinct(Filter(demo_project;User().Email in ShowColumns(Encargado;"Email"));Título)

- Gallery:

SortByColumns(Filter(demo_project; Título = ListaProyectos.Selected.Value && User().Email in ShowColumns(Encargado;"Email"));"Fecha_x0020_Termino";If(SortDescending1;Descending;Ascending))

What should I do sothe selected option in the first screenshot is used as an "input" so to speak, in the Gallery, so it shows the items belonging to that one? The droplist would also have selected that option, and the user would still be able to navigate options from it.

 

Thanks in advance,

  • Re: "Item" selected in Screen1 to be used as 'input' in Screen2

    @RandyHayes 

    Yet again, thank you!

     

    Will try later with a 3rd criteria -in another view- to see if I can manage by myself + what I did on this one

  • Verified answer
    RandyHayes Profile Picture
    RandyHayes 76,287 on at
    Re: "Item" selected in Screen1 to be used as 'input' in Screen2

    @Anonymous 

    I was wondering what you had on your button OnSelect actions...

    So, your OnSelect should be as stated before and then the Navigate formula.

       Set(_myFilter; "completado");; Navigate(....

     

    I know you use ; for , (I've been trying to substitute for clarity for you - even though I miss a few).

    I am pretty sure your combined statement separator is ;;  For me it is a single ;

     

    As for the formula:

    You just need to substitute in your dataSource and filter from the gallery.  I believe you've been using:

    SortByColumns(Filter(demo_project; Título = ListaProyectos.Selected.Value && User().Email in ShowColumns(Encargado;"Email"));"Fecha_x0020_Termino";If(SortDescending1;Descending;Ascending))

     

    You just need to substitute all this together like this:

    SortByColumns(
    Filter(
    AddColumns(
    Filter(demo_project; Título = ListaProyectos.Selected.Value && User().Email in ShowColumns(Encargado;"Email"));

    "Estado"; //here we are adding a column to your result set
    If('% Avance'=100;"completado";DateDiff(Today();'Fecha Termino')<0;"atrasado";DateDiff(Today();'Fecha Termino')<=5;"cercano";"tiempo")); //here we are setting the value of the Estado column
    Estado=_myFilter) //and here we are applying the value in the _myFilter variable (from the button) to the Filter
    ;"Fecha_x0020_Termino";If(SortDescending1;Descending;Ascending)) //and here we are sorting by the termino column

    Please remember as before, if you are going to use the Selected property for a Form somewhere (Galleryx.Selected) you will need to Drop that Estado column if you want to tie to to the DataSource demo_project. Otherwise, like before, you will get a error on it.

     

    Hope that clears it up some.

  • Re: "Item" selected in Screen1 to be used as 'input' in Screen2

    How can I have 2 different on select though? On the button, since the first onSelect is a navigate to gallery. How can I add/make that filter then?

     

    And, could you perhaps explain/break down the formula? Not sure what I am looking at @RandyHayes 

  • RandyHayes Profile Picture
    RandyHayes 76,287 on at
    Re: "Item" selected in Screen1 to be used as 'input' in Screen2

    @Anonymous 

    Yes, If I understood correctly...you have a screen with 4 buttons on it.  You want to have the user click on that button and filter your gallery based on that click.

    If that assumption is correct, then yes, on the buttons set those OnSelect actions.

     

  • Re: "Item" selected in Screen1 to be used as 'input' in Screen2

    A bit confused there.

    Should I go to the screen where I have the 4 categories, and on the "onselect" of each button, write "Set(_myFilter, "completado")"? Asking since I didn't find in the available properties the "onStart", unless, it is somewhere else?

  • Verified answer
    RandyHayes Profile Picture
    RandyHayes 76,287 on at
    Re: "Item" selected in Screen1 to be used as 'input' in Screen2

    @Anonymous 

    This might be a quick answer, so not needed in another thread.

     

    Let's start with the buttons - set the OnSelect action as follows (in the order I see in the photo):

       Button1 OnStart :  Set(_myFilter, "completado")

       Button2 OnStart :  Set(_myFilter, "tiempo")

       Button3 OnStart :  Set(_myFilter, "cercano")

       Button4 OnStart :  Set(_myFilter, "atrasado")

     

    So, this is where AddColumns is your friend.  As we did before, you would have an AddColumns formula that would provide the logic for each row that you can then filter against.

    So, for example in your Gallery Items:

    Filter(AddColumns(yourDataSourceOrFilter; "Estado"; If('% Avance'=100;"completado";DateDiff(Today();'Fecha Termino')<0;"atrasado";DateDiff(Today();'Fecha Termino')<=5;"cercano";"tiempo")); Estado=_myFilter)

    Hope that gets you going.

     

     

     

  • Re: "Item" selected in Screen1 to be used as 'input' in Screen2

    Not sure if should open a new topic, so will ask here @RandyHayes .

     

    With a button, it too would be in the default part?

    I have this view, that will allow the user search according to status/days left (or symbol). The items that are there are static buttons, ie, wont change them since those are the defined categories.

    boton1.png

     

    So, say, if an user selected those with yellow triangle, in the gallery view (it is another gallery, not the same one I have used for project), I would have only those that are "yellow triangle".

    boton2.png

    To get the images, I have the code as following:

    If(ThisItem.'% Avance'=100;okDate;DateDiff(Today();ThisItem.'Fecha Termino')<0;lateDate;DateDiff(Today();'Fecha Termino')<=5;closeDate;defaultDate)

    So where should I put a filter? option? to make it so I only see one kind of "symbol"?

     

     

    IF needed, I can throw this to a new thread instead of using this solved one.

  • RandyHayes Profile Picture
    RandyHayes 76,287 on at
    Re: "Item" selected in Screen1 to be used as 'input' in Screen2

    @Anonymous 

    Default is what a control "defaults" to.  You can use it to set an initial value of a control.  It is also the value that the control falls back to if you Reset the control.  Yes, you will use it often!

  • Re: "Item" selected in Screen1 to be used as 'input' in Screen2

    Thank you a lot @RandyHayes !

    That worked perfectly. The only thing I had missing from what you wrote was the "Default" category. What does it do, this one? To know for further info in case I need it again (which, considering, it is most likely)

  • Verified answer
    RandyHayes Profile Picture
    RandyHayes 76,287 on at
    Re: "Item" selected in Screen1 to be used as 'input' in Screen2

    @Anonymous 

     

    For your DropDown you should have:

        Items: Distinct(Filter(demo_project;User().Email in ShowColumns(Encargado;"Email"));Título) (assuming this works for you)

        Value: Result

        Default: galleryListaProyecto.Selected.Title  (assuming the value is in Title - if not, change as needed)

     

    Hope this helps.

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,475

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,767

Leaderboard