How to deactivate form when dropdown is empty?

I have a dropdown where users can choose products. When a product has been chosen, it can't be selected anymore.
After every product has been chosen, the dropdown is empty. 

I want to add functionality, so that if the dropdown is empty, the column is invalid and I'm not allowed to add a new product. 

The column is of type Text and has this valid if statement:
(SELECT(Product[Name], NOT([Is_Customer_Specific])) + [Customer_Product_Name] - SELECT(Order_Details[Product_Name], [Order_ID] = [_THISROW].[Order_ID]))

(SELECT(Product[Name], NOT([Is_Customer_Specific])) = select all products that are 
not customer specific

+ [Customer_Products] = add the customer specific products 

- SELECT(Order_Details[Product_Name], [Order_ID] = [_THISROW].[Order_ID])) = remove products that are already in the order

How do I add an invalid if statement, so that no option gets denied? I tried combining the select statement and the Isblank() function, but they are not of the same type.

Solved Solved
1 2 132
1 ACCEPTED SOLUTION

The simplest approach is to disable the ADD button once there are no more products to add so the Form can't be opened.  BUT...this can create confusion to the user as to why the ADD button disappeared. 

An alternative is to show a message that All products have been added.   However, once the dropdown becomes empty, this particular field will drop off the Form. 

So I would suggest implementing a validation check in one of the other fields - one that makes sense.  Simply add to the Valid IF an expression that performs a count check like this:

COUNT((SELECT(Product[Name], NOT([Is_Customer_Specific])) 
+ [Customer_Product_Name]
- SELECT(Order_Details[Product_Name], [Order_ID] = [_THISROW].[Order_ID]))) > 0

If count is greater than zero, that part of the Valid If will be valid and allow Form entry to continue as normal.

When the count falls to zero, this "display" column will become invalid, preventing a Save, and then you can show a validation message like:

 "All available products have been added.  Please tap Cancel to return to the Order."

 I hope this helps!

View solution in original post

2 REPLIES 2

The simplest approach is to disable the ADD button once there are no more products to add so the Form can't be opened.  BUT...this can create confusion to the user as to why the ADD button disappeared. 

An alternative is to show a message that All products have been added.   However, once the dropdown becomes empty, this particular field will drop off the Form. 

So I would suggest implementing a validation check in one of the other fields - one that makes sense.  Simply add to the Valid IF an expression that performs a count check like this:

COUNT((SELECT(Product[Name], NOT([Is_Customer_Specific])) 
+ [Customer_Product_Name]
- SELECT(Order_Details[Product_Name], [Order_ID] = [_THISROW].[Order_ID]))) > 0

If count is greater than zero, that part of the Valid If will be valid and allow Form entry to continue as normal.

When the count falls to zero, this "display" column will become invalid, preventing a Save, and then you can show a validation message like:

 "All available products have been added.  Please tap Cancel to return to the Order."

 I hope this helps!

Thankyou

Top Labels in this Space