Effective Date

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
customaware
Posts: 2413
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Effective Date

Post by customaware »

I have a BO Equipment with attributes

Effective Date
Equipment

So the data looks like

01/04/2010 Type A
18/09/2011 Type B
24/06/2012 Type C


So I need to retrieve an item of Equipment for a particular Date.
For example if my enquiry date is 14/10/2011 then I need to get Type B.
And if my enquiry date is 03/07/2012 then I need to get Type C.

In my Rule, the following does not work...

FIND Equipment WHERE MyDate>=Equipment.EffectiveDate

As any date after the earliest record will always get the first record rather than the record with an effective date immediately prior to my date.

Can anyone please suggest an alternative that finds the right record?

Thanx in advance.
customaware
Posts: 2413
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Post by customaware »

Ah.....

FIND Equipment WHERE MyDate>=Equipment.EffectiveDate ORDER BY Equipment.EffectiveDate DESC TAKE BEST 1

Solved.

Awesome. :wink:
Post Reply