How can I implement a Form field to either be required forcing user input OR not required with default value set

Consider placing order for products where dimensions are user specified. I have some products with a standard width and the user orders the length. Or the product might allow the user to to specify the width and length.

In the Order Form, I want to show that a Product has standard width by initializing the value to the width and making the field non-editable. But for Products where the user specifies the width, I want the width field to be required with NO value set, forcing the user to enter a valid width value.

If I implement the Initial value like:

IF([Product].[Has Standard Width?], [Product].[Standard Width], "")

in the case where there is no standard width (a decimal), the initial value still defaults to zero (as if entered), is allowed to save with zero and can result in potential error.

In this use case, how can I achieve this, i.e. set the Initial Value as if NOT entered, forcing the user to enter a valid width value?

Structure your expression like this to eliminate the zero value for the FALSE evaluation of the IF expression:

IF(
    [Product].[Has Standard Width?],
    [Product].[Standard Width],
    NUMBER("")
)
3 Likes

Yes, that works! Thanks for the quick reply.

1 Like

You’re welcome