How can I enter a date in a calculation field?
I have ... EndDate = StartDate + N°Days
I need to be able to manually enter the EndDate when the StartDate or N°Days are unknown.
Use an Auto-Enter calculation for the field. In the Options dialog box for the field, select the Auto enter tab.
Check the "Calculated value" checkbox and enter your calculation.
If you leave the "Do not replace..." checkbox unchecked, any time the StartDate or N°Days changes, the field will update.
To clarify, use a date field, not a calculation field. The auto enter calculation fills the date field based on your calculation, while giving you option to also edit it manually. In your calculation use a conditional statement so that it will only evaluate if you have both the data both Start Date and N°Days fields.
Thank you, just the job with an IsEmpty conditional statement.
I have another question ...
I usually have the table sorted by StartDate in descending order with the latest on top.
How can I get the empty StartDates to head the list?
dates, times and the "new" kid on the block (ExecuteSql, returning dates and times in their peculiar format) have a common ground. Every bit of info regarding date/time can be converted to a positive integer starting with january 1st, year 0 or whatever.
If you transform everything into an integer, you can find and sort better. You can associate "empty" with 31.12.2199 and sort descending on that. IMHO, learn to see any date/time/timestamp info as an integer and start from that, you'll win.
Try creating another field, something like "SortDate". Make it a calculation that returns a date:
IsEmpty ( EndDate ) ; "12/31/4000" ; //if no EndDate, use a date waaaay in the future
EndDate //otherwise, use the EndDate
Then sort by the SortDate field instead.
Retrieving data ...