Re: DateTime fields in GROUP BY, manual relations and offline data

DObject O/R Mapping Suite

DateTime fields in GROUP BY, manual relations and offline data


vojko 08-27-2007, 1:43 PM
Hi, 1. Is it possible to make OQL statements for DateTime fields, statements to extract grouped data like to get average per day over one month or similar. Here is an examples of MS SQL statement, where we get grouped records of sum,max,...., per ours: Also pay attention to DATEPART function .... 'SELECT DATEPART([YEAR], MyDateTimeFieldName') AS MyYEAR, DATEPART([MONTH], MyDateTimeFieldName') AS MyMONTH, DATEPART([DAY], MyDateTimeFieldName') AS MyDAY, DATEPART([HOUR], MyDateTimeFieldName') AS MyClock, COUNT(*) AS NumberOfGroupedRecords, SUM(FLD1) AS MySUM, MAX(FLD2) AS MyMAX, CASE TARIFA WHEN 1 THEN ''KT'' WHEN 2 THEN ''VT'' WHEN 3 THEN ''MT'' END AS MyTarifa FROM MYTABLE WHERE (DATEPART([YEAR], MyDateTimeFieldName') = '+CAST(@Leto AS char(4))+' ) AND (DATEPART([MONTH], MyDateTimeFieldName') = '+CAST(@Mesec AS char(2))+' ) AND (DATEPART([DAY], MyDateTimeFieldName') = '+CAST(@Dan AS char(2))+' ) GROUP BY DATEPART([YEAR], MyDateTimeFieldName'), DATEPART([MONTH], MyDateTimeFieldName'), DATEPART([DAY], MyDateTimeFieldName'), DATEPART([HOUR], MyDateTimeFieldName') , TARIFA ORDER BY MyClock 2. Wondering if it is possible to make manual relationship between tables. Many times we don't use DB's relations but make our own in the code. 3. What is the easiest way to make offline data ? To get ObjectDataSets and stream them to local files, XML or to local DB ? thank you, Kompozit EMRA d.o.o. Vojko Cendak,univ.dipl.ing.

Re: DateTime fields in GROUP BY, manual relations and offline data


Wisdom 08-27-2007, 7:44 PM
1. Currently there is no function for DateTime.
The features about functions of DateTime will be added to our develop plan.

2. You can make manual relationship with editing the .xobject schema file.
Add some data to <ObjectSet Name="DoRelation"> and <ObjectSet Name="DoRelationField"> to make relationship manual.
We will add this feature to Macrobject CodeAuto.

3. You can use TXmlProvider to access a XML database.
Or you can use TXmlHelper for saving and loading ObjectSet or ObjectSpace.
Please take a look at "Macrobject.DObject.chm" for more information.

Powered by Community Server, by Telligent Systems