Now I'm trying to filter one Drop Down list, but the difficult is that the target field is in other SP list.
I have a Machinery Screen:
And the TimeSheet Screen:
The field names and "imput text" are in Machinery Screen:
Fecha Alta = DataCardValue23 (On hire date)
Fecha Baja = DataCardValue24 (Off hire date)
Title = DataCardValue26 (Machinery)
And in the TimeSheet Screen:
Fecha = DataCardValue3 (Date)
Equipo = DataCardValue4 (Machinery)
The Dropdown list of the Mchinery in TimeSheet Screen is a lookup field from the Machinery Screen.
So, I don't want show the Machinery that is not "active", and the conditions will be depend of the date in TimeSheet screen and the dates in Machinery Screen.
I was thinking in two options:
Option 1 - Easiest (I think):
I have an hide field on Machinery Screen. That field is the Status, that calc depend of the dates (basicaly if the Off hire date is complete or not), the values are "Activo" or "Inactivo". For this option I tried diferent things, but doesn't work, like:
Items property over "Equipo" field on TimeSheet Screen:
Filter(Choices([@'ALQUILER EQUIPOS - HORARIOS Y TRABAJOS'].Equipo); Value in Filter ('ALQUILERES EQUIPOS'; estado = "Activo").Equipo)
"Alquiler Equipos - Horarios y Trabajos" (Source on TimeSheet)
"Alquiler Equipos" (Source on Machinery Screen)
Option 2 (I will preffer this one, but I don't know if is possible or is so hard to do it):
I don't want show the machinery: if "date" that you write is before to "on hire date" or later to "of hire date", and in case that the "off hire date" is blank don't show the machinery "on hire date" is later that the date on timesheet.
Hi @ Manarjomar：
Could you tell me :
Does this lookup field allow multiple selections?(Equipo)
What is your filter rule? Could you describe it in detail?( What function is implemented in which field of which data source meets what conditions?)
Firstly, let me explain why the code doesn’t work.
The result returned by "Filter (...). E" is a table with a nested structure, and the “Value” you need to retrieve is in it’s sub-table. This caused the code to not work.
Secondly, I suggest you try this code:
Filter(Choices([@'ALQUILER EQUIPOS - HORARIOS Y TRABAJOS'].Equipo);Value in ForAll(Filter('ALQUILER EQUIPOS - HORARIOS Y TRABAJOS'; estado = "Activo");Equipo).Value)
I am not sure what you mean by “I don't want show the machinery:……hire date" is later that the date on timesheet”.
But, if you would like to share more details with me, I will be happy to discuss the solution with you.
I tried make a translatios for expain my scenario, sorry if is not the best translation. hehehe
For the option 1:
I have two table (or list)
"ALQUILER EQUIPOS" that have the field "Equipo" and the target field "Estado" (values = "Activo" / "Inactivo"). This list manage a list of "Machinery".
"ALQUILER EQUIPOS - HORARIOS Y TRABAJOS" have the lookup field "Equipo" (With multiselection: the name of the machinery in field "Equipo" and the "Estado" of the list "ALQUILER EQUIPOS") and is the Dropdown field that I need to filter. The objetive of this list manage the works and timesheet for each worker and machinery.
Thank for the suggest, but the code doesn't work:
For the option 2:
Trying to explain...
For the Option 1, was make a filter using the field "Estado", but with this option I would like make it if the diferent dates it fulfill the conditions:
"ALQUILER EQUIPOS" have two field dates "Fecha Alta" (like "on hire date" in English), "Fecha Baja" ("Off hire date" in English").
"ALQUILER EQUIPOS - HORARIOS Y TRABAJOS" have the field "Fecha" (date to manage the TimeSheet).
The condition to show the Machinery "Equipo" in the dropdown will be with two conditions, and could be something like:
If(And(IsBlank('ALQUILER EQUIPOS'.'Fecha Baja');'ALQUILER EQUIPOS - HORARIOS Y TRABAJOS'.Fecha >= 'ALQUILER EQUIPOS'.'Fecha Alta);And('ALQUILER EQUIPOS - HORARIOS Y TRABAJOS'.Fecha >='ALQUILER EQUIPOS'.'Fecha Alta';'ALQUILER EQUIPOS - HORARIOS Y TRABAJOS'.Fecha <='ALQUILER EQUIPOS'.'Fecha Baja'))
I know that could be difficult, but with this option the form can permit me create a record if the machinery is "off hire" but the date is between the "onhire date" (Fecha Alta) and "offhire date" (Fecha Baja).
I hope that you can understand me.
HI @Manarjomar :
Maybe you can try this code:
Filter(Choices([@'ALQUILER EQUIPOS - HORARIOS Y TRABAJOS'].Equipo);Value in Ungroup(Filter('ALQUILER EQUIPOS - HORARIOS Y TRABAJOS'; estado = "Activo");Equipo).Value)
Do you want to influence the options of Choices([@'ALQUILER EQUIPOS - HORARIOS Y TRABAJOS'].Equipo) by filtering the value of 'ALQUILER EQUIPOS' and 'ALQUILER EQUIPOS'?
Although I still don't understand it very well-maybe because of the language. In my opinion, the lookup field of Equipo allows multiple selections, which makes it difficult for us to judge whether the 'Fecha Baja' in the associated 'ALQUILER EQUIPOS' table is empty.
Ok @v-bofeng-msft , forget the Option 2.
Howeaver, the code for the Option 1, I don't understand where is the error, because with your new code, doesn't work neither...
I tried with this one alse:
Filter(Choices([@'ALQUILER EQUIPOS - HORARIOS Y TRABAJOS'].Equipo);Value in ForAll(Filter('ALQUILERES EQUIPOS'; Estado = "Activo");Equipo).Value)
Only because I thought the "Estado" field is on the other table ("ALQUILERES EQUIPOS") was not possible find in "ALQUILER EQUIPOS - HORARIOS Y TRABAJOS", but doesn't work also.
But when I try.
For me was impossible fix the problem like I wanted, but inestead I found other "simple" way.
I created a new field on the main list "ALQUILER EQUIPOS", a calculate field make as concatenate string with the field name of "Equipo" and the field name "Estado", to have this one in the app:
Later I can filter the drop down with the string "(Activo)":
Filter(Choices([@'ALQUILER EQUIPOS - HORARIOS Y TRABAJOS'].Equipo); "(Activo)" in Value)
So the Machineries ("Equipo") that is offhire ("Inactivo"), is not on the list.
This is not the solution that I wanted it but works.
Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.
Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.
The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.
We are excited to announce a new way to share your ideas for Power Apps!