Previous Thread
Next Thread
Print Thread
XTREE Empty Dates #37094 09 Feb 24 11:04 PM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content OP
Member
OP Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
A developer is wondering about how to allow blank dates in XTREE...
Quote
Very often we need "blanked" dates, i.e. empty dates o "zero dates" (00/00/00), meaning that no date has been captured yet.
In XTREE we haven't found a way to to make it equal to zero or null, once you entered the date.

Like everything else in XTREE, there are many possibilities here, so this may require a couple of passes. But to begin, there are two essentially different approaches to edting dates: as strings, or using the special pop-up date/calendar control. For the standard string version, just specify the Standard Date Format (D) for the cformat. This acts like a regular string when it comes to editing, i.e. it does not do any validation. So there is nothing stopping you from entering a blank date, or a date consisting of 00/00/00. Typically though, if you are allowing users to enter dates, you probably want to provide some validation logic to enforce whatever rules you may have. (The only difference between the D and S cformat codes is that D attempts to support a variety of date formats when it comes to sorting. (Note that the cformat code n controls whether blank dates sort to the bottom or the top.)

The other alternative is to use the pop-up calendar control for date entry, which is enabled by adding the Advanced Coldef Option InfDef=D. That control does not allow for a blank date, but you can make the date optional by adding O to the InfDef string, i.e. Infdef=DO

If that doesn't completely address the issue, let's have another round...

Re: XTREE Empty Dates [Re: Jack McGregor] #37095 10 Feb 24 12:34 AM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content OP
Member
OP Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
Here's a sample program in the SOSLIB illustrating the date picker version, one mandatory and one optional ... XTRADP.BP
It uses this coldef :
Code
COLDEF$ += .offsiz$(ST_XTROW.ID)+"~ID~#~~"
COLDEF$ += .offsiz$(ST_XTROW.SDATE)+"~StartDate~DE~Format=MM/dd/yyyy|24~~"          ! mandatory date
COLDEF$ += .offsiz$(ST_XTROW.STIME)+"~StartTime~hE~~"
COLDEF$ += .offsiz$(ST_XTROW.EDATE)+"~EndDate~DE~InfDef=DO~Format=MM/dd/yyyy|24~~"  ! optional date
COLDEF$ += .offsiz$(ST_XTROW.STIME)+"~EndTime~hE~~"

which ends up looking like this:
[Linked Image]
(The checkbox allows you to toggle whether the data is empty or not.)

Re: XTREE Empty Dates [Re: Jack McGregor] #37096 11 Feb 24 12:31 AM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content OP
Member
OP Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
FYI, in the process of reviewing this, a very strange bug was discovered in which the 2nd date edited might get initialized with the first date clicked on but not changed. The problem is believed to be fixed in this beta update:

ash-7.0.1755.0-w32-upd.zip
ash70notes.txt


Moderated by  Jack McGregor, Ty Griffin 

Powered by UBB.threads™ PHP Forum Software 7.7.3