Dependent dropdown for enum list

Dependent dropdowns are doing my head in!

I have two use cases, I managed to implement one of them, but I am not sure how it works.

I have 4 tables

Items, Machines, Department and Daily Log with the following relationships

A Department can have many machines

A Machine can only belong to one department

An item can be made in many departments

In the daily log table, I want the users to be able to choose the department.

Paras_Sood_0-1654143035370.png

 

Based on the department chosen, I have the following two use cases:

1. Based on the department, I want users to be able to choose from a list of machines that belong to that department.

How I achieved this:

In the Department ID, I added a valid_if constraint: Machines[Department ID] and in machine ID, I added another valid_if constraint: Machines[Machine ID]

This works as expected but I am not sure why this works to be honest.

2. Based on the department, I want users to be able to choose from a list of items that belong to that department.

I tried the following valid_if constraint for item ID:

 

 

IN( 
	[_THIS], 
	SELECT(
		Items[Item ID], 
		IN(
			[_THISROW].[Department ID], 
			Items[Department]
		)
	)
)

 

 

However, this gives me a list of all of the products and does not narrow it down by department.

I believe that my solution to my use case #1 might be hindering use case#2

Do you have any suggestions to fix this? @TeeSee1 

 

Solved Solved
0 7 311
2 ACCEPTED SOLUTIONS

Dept ID: No valid-if required because you are already referencing the Dept and you do not want to constrain values here because this is the first field for the user to select

Machine ID:  FILTER("machines", [Dept ID] = [_THISROW].[Dept ID]

ITEM ID:  FILTER("items", [Dept ID] = [_THISROW].[Dept ID]

 

I am assuming that Machines and Items both have a ref col to dept.

View solution in original post

FILTER("Items", IN([_THISROW].[Department ID],[Department]))

Should be just [Department], not [Department ID]

View solution in original post

7 REPLIES 7

Dept ID: No valid-if required because you are already referencing the Dept and you do not want to constrain values here because this is the first field for the user to select

Machine ID:  FILTER("machines", [Dept ID] = [_THISROW].[Dept ID]

ITEM ID:  FILTER("items", [Dept ID] = [_THISROW].[Dept ID]

 

I am assuming that Machines and Items both have a ref col to dept.

Thank you for your prompt reply. The formula for machine id works wonderfully

However. Departments in the Items table is an enum list of base type ref (to satisfy the condition that an item can belong to many departments)

I tried:

FILTER("Items", IN([_THISROW].[Department ID],[Department ID]))

but it returns me with an error: 

Parameter 2 of function IN is of the wrong type
 

Your formula seems correct.

Need to see the exact definitions of your columns.

This is the item ID from the daily log table:

Paras_Sood_0-1654149098835.png

This is from the Items table:

Paras_Sood_1-1654149164697.png

This is the department column in the Items table

Paras_Sood_2-1654149226016.png

 

 

This is the backend of the daily log table

Paras_Sood_3-1654149281477.png

 

This is the backend of the items table:

Paras_Sood_4-1654149310225.png

 

FILTER("Items", IN([_THISROW].[Department ID],[Department]))

Should be just [Department], not [Department ID]

Hahahaha I guess it's time to go home now, should have spotted that mistake by myself. Thank you mate.

Top Labels in this Space