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:
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.
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,
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
@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.
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
@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.
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?
@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.
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.
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".
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.
@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!
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)
@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.