Set Default Value or N/A for Date Time Field

Hi Everyone,

In the app I am building , we enter batch no, expiry date , status for each material. We have many materials and use a single step to capture all the material information and set the required material name on step enter. For few materials some values are not applicable and we keep N/A for the batch no or status since it is text field. But there are some scenarios where Expiry Date is not applicable and since it’s a date time field we can’t set “N/A” . Is there any way we can set some default value like “0000000” or anything to indicate the user it is not needed?

Hi @pujitha

I have 2 thoughts here:

  1. You can label your date picker input to include “not required” as a signal to the app users

  2. You can set a default value for the date picker if you go into the right hand app editor menu, go to edit variable, and then choose default value for the date.

Ultimately, this should get easier soon, as the team is working on data validation on input widgets that will allow you to indicate visually to app users what is required and not required without needing to user triggers or workarounds! @ychan164 I’ll let you chime in with any other details there!


I want to add, if it is not only to be visible on the input form in the app but you want to store clear (understandable) values, there is some best (common) practice around dates:

E.g. for valid from dates where the material is imported and not created on that platform, the date can be the import date or a reference to some common epoch reference date as the well known unix time reference (1970-01-01)

For dates as expiry dates, you could use something like:

For valid from dates, where the data set has been created but not released yet, you could do something as today + 1000 years (3024-02-16) where you can choose another number as well. With 1000 you can see the “when this was set date”, what is great, but you can easily oversee the 3 (e.g. with a display format as MMM-DD-YY). Thats not a big deal, but you need to keep that in mind!

Both practices ensure, all functions will consider them as not valid yet. With the year far away you can also check if a date was already set (if date > today+500 then no date is set)…

Hope that helps.
It always depends on the use case what you consider as best practice :wink:


@Beth is right on. With the new feature set, marking an input required will be a property you can switch on in the context pane. You’ll also be able to add more specific data validation rules to inputs that will come with an in-line error message if an operator’s value breaks a rule. Stay posted with this functionality coming very soon to the app editor!

Thank You for the sugeestions @Beth. The team does not want to set a default date, but rather leave it empty. I have managed to write a trigger on the date picker widget to not to allow any values which has solved the problem for now. The specific data validations on input fields would definitely help in scenarios like these.

1 Like