Yes, you can do it that way too.  The effect is the same as using the Read
Format - the calue can be temporarily out of sync if you change the date
value. The advantage of doing it in EntityModeler is that you can put this
into prototypes and have an application that supports multiple databases.
Done as a trigger, you need to re-implement to compensate for differences
between databases.

Chuck


On 2015-07-13, 6:54 PM,
"webobjects-dev-bounces+chill=gevityinc....@lists.apple.com on behalf of
Timothy Worman" 
<webobjects-dev-bounces+chill=gevityinc....@lists.apple.com on behalf of
li...@thetimmy.com> wrote:

>Just asking out loud mostly out of curiosity and a desire to get abused -
>I haven¹t done this. Depending on the database could you use a trigger to
>update a ³yyyy-mm" column in the database on commit? Then model that
>column in addition to the date?
>
>If you weren¹t commonly committing changes to the initial date it seems
>like it would be pretty safe?
>
>Tim Worman
>UCLA GSE&IS
>
>
>> On Jul 13, 2015, at 2:18 PM, Calven Eggert <cal...@mac.com> wrote:
>> 
>> I'm not going good to be changing the value of the date but thanks for
>>the heads up. Good idea on using the calculation to get a number!
>> 
>> Calven
>> 
>> 
>> On Jul 13, 2015, at 5:11 PM, Samuel Pelletier <sam...@samkar.com> wrote:
>> 
>>> Keep in mind that the YM value on your EO will not be updated if you
>>>change the apptDate unless you refresh the object from the database.
>>> 
>>> To save string creation and manipulation on the server, you may
>>>generate a number instead of a string...
>>> 
>>> EXTRACT(YEAR FROM APPT_DATE) * 100 + EXTRACT(MONTH FROM APPT_DATE) AS
>>>YM
>>> 
>>> Samuel
>>> 
>>>> Le 2015-07-13 à 16:48, Calven Eggert <cal...@mac.com> a écrit :
>>>> 
>>>> Thanks Chuck!
>>>> 
>>>> I had to add the ŒAS¹ clause to the Read Format, otherwise, I
>>>>received an invalid SQL statement.  I then took advantage of the
>>>>situation by concatenating my two values (year and month) and padded
>>>>the month so that I would always get a 6 digit string so I could then
>>>>do some comparisons with the value for a report.
>>>> 
>>>> Read Format:
>>>> EXTRACT(YEAR FROM APPT_DATE) || LPAD(EXTRACT(MONTH FROM APPT_DATE),
>>>>2, '0') AS YM
>>>> 
>>>> 
>>>>> On Jul 13, 2015, at 4:10 PM, Chuck Hill <ch...@gevityinc.com> wrote:
>>>>> 
>>>>> Sorry, not derived.  Battling too many tasks this morning.  A read
>>>>>format should do it (so the same column defined as three class
>>>>>property attributes: theDate, theDateYear and theDateMonth (feel free
>>>>>to pick better names :-)
>>>>> <DE4C48C1-45C2-420F-A017-59C3BC72CBD6.png>
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> On 2015-07-13, 1:05 PM, "Theodore Petrosky" wrote:
>>>>> 
>>>>> I just looked in there. How do you set that up? I tried playing but
>>>>>I guess I don¹t understand the derived column.
>>>>> 
>>>>> Thanks Chuck!
>>>>> 
>>>>> 
>>>>>> On Jul 13, 2015, at 2:20 PM, Chuck Hill <ch...@gevityinc.com> wrote:
>>>>>> 
>>>>>> Just a note that you can use the  extract (year from theDate) and
>>>>>>extract (month from theDate) in a derived column in EntityModeler
>>>>>>which avoids the need for a view.
>>>>>> 
>>>>>> On 2015-07-13, 11:16 AM, "Theodore Petrosky" wrote:
>>>>>> 
>>>>>> you didn¹t mention your database, but I have done things like this
>>>>>>with a view.
>>>>>> 
>>>>>> I created a view with the appropriate columns and in the select
>>>>>>statement I put in the order by
>>>>>> 
>>>>>> CREATE OR REPLACE VIEW myNewView AS SELECT info1, info2, theDate
>>>>>>FROM theTable ORDER BY extract (year from theDate) desc, extract
>>>>>>(month from theDate) asc;
>>>>>> 
>>>>>> A one point I actually set up some rules to make the ŒVIEW¹
>>>>>>updatable.
>>>>>> 
>>>>>> YMMV obviously depending on you access to the backend, and if Views
>>>>>>are supported.
>>>>>> 
>>>>>> Ted
>>>>>> 
>>>>>> 
>>>>>> On Jul 13, 2015, at 12:02 PM, Calven Eggert <cal...@mac.com> wrote:
>>>>>> Hi, All
>>>>>> I have a fetch that sorts records by three columns where one of the
>>>>>>columns is a date (timestamp).  Is there a way to sort the date by
>>>>>>month & year only?
>>>>>> Thanks,
>>>>>> Calven
>>>>>> Here is the current fetch:
>>>>>> ...
>>>>>> EOSortOrdering sortBySource = new EOSortOrdering("source",
>>>>>>EOSortOrdering.CompareCaseInsensitiveAscending);
>>>>>> EOSortOrdering sortByAppt = new EOSortOrdering("appointmentDate",
>>>>>>EOSortOrdering.CompareCaseInsensitiveAscending);
>>>>>>      EOSortOrdering sortBySite = new EOSortOrdering(³site",
>>>>>>EOSortOrdering.CompareCaseInsensitiveAscending);
>>>>>>      NSMutableArray orderings = new NSMutableArray();
>>>>>>      orderings.addObject(sortBySource);
>>>>>>      orderings.addObject(sortByAppt);
>>>>>>      orderings.addObject(sortBySite);
>>>>>> EOFetchSpecification spec = new EOFetchSpecification(³records",
>>>>>>qual, orderings);
>>>>>> _______________________________________________
>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>> 
>>>>>>https://lists.apple.com/mailman/options/webobjects-dev/tedpet5%40yaho
>>>>>>o.com
>>>>>> This email sent to tedp...@yahoo.com
>>>>>> 
>>>>>> 
>>>>>> _______________________________________________
>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>> 
>>>>>>https://lists.apple.com/mailman/options/webobjects-dev/chill%40gevity
>>>>>>inc.com
>>>>>> 
>>>>>> This email sent to ch...@gevityinc.com
>>>>> 
>>>> 
>>>> 
>>>> Calven
>>>> 
>>>> 
>>>> 
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>>> Help/Unsubscribe/Update your Subscription:
>>>> 
>>>>https://lists.apple.com/mailman/options/webobjects-dev/samuel%40samkar.
>>>>com
>>>> 
>>>> This email sent to sam...@samkar.com
>>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> 
>>https://lists.apple.com/mailman/options/webobjects-dev/lists%40thetimmy.c
>>om
>> 
>> This email sent to li...@thetimmy.com
>
>
> _______________________________________________
>Do not post admin requests to the list. They will be ignored.
>Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>Help/Unsubscribe/Update your Subscription:
>https://lists.apple.com/mailman/options/webobjects-dev/chill%40gevityinc.c
>om
>
>This email sent to ch...@gevityinc.com


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to