Hi @Star_Citizen ,
Setting the DatePicker Default Date
For the DefaultDate property of the DatePicker control Date_P, you want to show the current date/time if a certain value in the form is blank, otherwise show the value from the form. The formula would look something like this:
If(
IsBlank(LookUp(MainDataSource, ID = Mainform.LastSubmit.ID).Head_Line_Date),
Now(),
LookUp(MainDataSource, ID = Mainform.LastSubmit.ID).Head_Line_Date
)
Setting the DatePicker Display Mode
For the DisplayMode property of the DatePicker control Date_P, you want it to be in display mode if the form is in display mode and in edit mode otherwise. The formula for this would be:
If(
Mainform.Mode = FormMode.Edit,
DisplayMode.Edit,
DisplayMode.View
)
If you get errors regarding the reference to the form field, ensure that the DataCardValue1 reference is correctly pointing to the data card value within the form that holds the date. If DataCardValue1 is the correct name, your formula should work if you replace the lookup logic with the reference to the data card. For instance:
If(
IsBlank(DataCardValue1.Text),
Now(),
DateValue(DataCardValue1.Text)
)
This will look up the tab in the collection where the TabId matches the CurrentTabId.
Kindly mark the solution as accepted if it resolves your issue.
Best Regards
Muhammad Mudassar Mazhar