Hi, i'v been banging my head for hours on this strange behavior...

Background:  My inventory transaction system allows people to make transaction 
on exactly the same date (they use cut and paste to put exactly the same 
date/time in a bunch of transactions). But I need to process them 
chronologically and those transactions EO contain some data such as cumulated 
values, average costs cumulated quantities....

Fetching EO  sorted by date will not guarantee the same order each time its 
executed, so I taught I would additionally sort by primary keys to fix the 
order once and for all.

Part 1) I use  a fetchspec named "updateTransactionCost" that is defined in 
EOModeler and in the tab "Sort Orderings", my first item is "dateEnd" ascending 
and the second line is "id" ascending. That technique seems to work.

<<inline: Screen shot 2011-02-20 at 14.51.48 .png>>


Part 2) I need a support method to find the latest transaction before a 
specific date. To do so I use a fetchspec also defined in EOModeler define the 
Qualifier as "dateEnd < $beforeDate and part = $part and part.spec = $spec" and 
the sort ordering tab as "dateEnd" descending and the second line is "id" 
descending. I set the mac rows in the option's tab to 1 as I'm interested only 
in the latest transaction before the date.

<<inline: Screen shot 2011-02-20 at 14.46.00 .png>>


I then use the Wonder generated Transaction.fetchTransactionBefore() to get the 
array, but it is not sorted properly by id. It seems that only the first sort 
order key (date) is being used...

Here is sample debug output when enumerating in chronological order <> are 
primary keys

<35474> 2011-01-10 19:07:36 Etc/GMT  Q: 1/1 
<35475> 2011-01-10 19:07:36 Etc/GMT  Q: 1/2 
<35472> 2011-01-20 19:07:36 Etc/GMT  Q: 1/3 
<35473> 2011-01-20 19:07:36 Etc/GMT  Q: 1/4 
<35478> 2011-01-20 19:07:36 Etc/GMT  Q: 1/5 
<35476> 2011-01-30 19:07:36 Etc/GMT  Q: 1/6 
<35477> 2011-01-30 19:07:36 Etc/GMT  Q: 1/7 

and if I print the latest

latest before 2011-01-25 19:07:36 Etc/GMT  <35472>2011-01-20 19:07:36 Etc/GMT 
Q: 1/3 

Any clues ? or alternative algorithm to find my latest transaction method ?

Thanks in advance...

PS: using latest of everything...



Louis Demers eng.
www.obzerv.com


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

This email sent to [email protected]

Reply via email to