Hello!
I have simple table with two dates: 'from' and 'to'. Date 'to' is optional.
I want to see all elements between dates 'from' and 'to' - if 'to' is specified and all elements greater than 'from' if 'to' is not specified.
Sample code:
module Shop
{
type PK : Integer64;
type SimpleDictionary
{
id : PK => AutoNumber();
name : Text#40;
displayname : Text#40;
active : Logical => true;
visible : Logical => true;
usefrom : DateTime;
useto : DateTime?;
} where identity (id), unique(name);
type KindType : SimpleDictionary
{
parent : KindType? where value in Kind;
};
Kind : KindType*;
AvailableKind(now : DateTime)
{
Kind.active(true)
where value.usefrom >= now
&& (value.useto ?? true : (value.useto < now)); // 1
//&& (value.useto == null || (value.useto != null && value.useto < now)); // 2
}
}
The problem is:
1 - error M0197: 'value.useto < now' cannot be used in a type context. To be used in a type context a value must be a collection.
2 - error M0102: Could not find binary operator '&&' with left-hand side type 'Logical' and right-hand side type 'Logical?'.
Haw to get required elements?
Thanks and Regards