cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Manarjomar
Resolver I
Resolver I

Drop Down List filtered from another list in other source and conditions

Hi again,

 

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:

 

Screenshot_1.png

 

And the TimeSheet Screen:

 

Screenshot_2.png

 

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.

 

Thank you.

5 REPLIES 5
v-bofeng-msft
Community Support
Community Support

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?)

Option1:

Firstly, let me explain why the code doesnt work.

The result returned by "Filter (...). E" is a table with a nested structure, and the Value you need to retrieve is in its 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)

Option2:

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.

 

Best Regards

Bof

Hi@v-bofeng-msft 

 

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:

 

Screenshot_3.png

 

 

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.

 

Thank you.

 

 

 

 

 

HI @Manarjomar :

Option1:

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)

Option2:

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.

 

Best Regards,

Bof

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...

 

Screenshot_4.png

 

 

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.

 

Screenshot_5.png

 

 

But when I try.

 

Screenshot_6.png

 

 

Regards.

 

 

 

Finally

 

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:

 

 

Screenshot_1.png

 

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.

 

Thank you.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (2,900)