An error has occurred when executing the following SQL statement via DataWindow Retrieve.
SQL syntax:
select id typeid, "Fname"||' - '||"Lname" as FullName, diner + interval '1 day' dinneAdd1, costs* 0.85 *(case when id%2 = 0 then 1 else -1 end ) zk, birthday + interval '10 day' , salary * 1.1 sales, to_char(cast(mobilephone as int),'###-####-###') from t_dwstyle_alltype a where /*DATEDIFF(d,birthday,'1000-02-01') between 8 and 10*/ EXTRACT(day from birthday - to_timestamp('1000-02-01','YYYY-MM-DD')) > 8 and EXTRACT(day from birthday - to_timestamp('1000-02-01','YYYY-MM-DD')) < 10 or birthday is null order by typeid
When the DataWindow retrieves data using the SQL, an error message pops up: The property does not allow null value: Dinneadd1.
Debugging technique:
The error indicates that the model generated from the DataWindow has set non-nullable attribute to the column. However, the Dinneadd1 column is a computed column, so it shall be nullable. It is necessary to check the .cs file of the generated model, find the column and set nullable attribute to it.
For example, the column defined in the model is:
[DwColumn("dinneadd1")] public TimeSpan Dinneadd1 { get; set; }
Add the nullable attribute to the column:
[DwColumn("dinneadd1")] public TimeSpan? Dinneadd1 { get; set; }
Note: If the SQL syntax contains left join, or union, it may induce similar error.