|
Just to finish this up, we got lazy and decided to convert them all to dates and select our range that way. For the record my boss said he got the formula. -1(6((-(2(12-x))/|(2(12-x)|)-1)+11) where x is the period. Took him about 4-5 hours to get this figured out. I like the casting to date better. On 1/5/06, Mike Wills <koldark@xxxxxxxxx> wrote: > > Well... I guess not... Only works for period 12. > > On 1/5/06, Mike Wills <koldark@xxxxxxxxx> wrote: > > > > Aw crap... Here is the formula (I swear I am dyslexic). > > > > =((((12-A1)/(12-A1))*12)-11)+A1 > > > > A1 = period or month. Matt's suggestion works. > > > > On 1/4/06, DeLong, Eric <EDeLong@xxxxxxxxxxxxxxx> wrote: > > > > > > Mike, > > > > > > I'm afraid I'm not seeing what you're trying to do.... Perhaps I'm a > > > bit > > > rusty at algebra, but to me this formula does not seem to do > > > anything.... > > > > > > ( ( ( (period-12) / (period-12) ) * 12 ) - 11 ) + period = > > > ( ( ( 1 ) * 12 ) - 11 ) + period = > > > ( ( 12 ) - 11 ) + period = > > > ( 1 ) + period > > > > > > Huh? > > > > > > > > > Eric DeLong > > > Sally Beauty Company > > > MIS-Project Manager (BSG) > > > 940-297-2863 or ext. 1863 > > > > > > > > > > > > -----Original Message----- > > > From: rpg400-l-bounces@xxxxxxxxxxxx > > > [mailto: rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Mike Wills > > > Sent: Wednesday, January 04, 2006 5:32 PM > > > To: RPG programming on the AS400 / iSeries > > > Subject: Formula Question > > > > > > > > > Okay, this may be a difficult one. I have a simple table layout like > > > this. > > > > > > Company (4,0) > > > Year(4,0) > > > Period(2,0) > > > Amount(15,2) > > > > > > I want to be able to take an ending period and determine 12 months > > > back from > > > the ending date and select records in the DB via a select statement. > > > We are > > > really close with the following formula: ( ( ( (period-12) / > > > (period-12) ) * > > > 12 ) - 11 )+period. A co-worker of mine got this far. If it wasn't for > > > the > > > whole divide by zero bit as this portion ( (period-12)/(period-12) ) > > > would > > > for period 12, it would work great. Short of a case statement is there > > > a > > > better way to handle divide by zero? Or is the a better formula that > > > we > > > aren't seeing? > > > > > > -- > > > Mike Wills > > > koldark@xxxxxxxxx > > > http://mikewills.name > > > Want Gmail? Email koldark+gmail@xxxxxxxxx to get on my waiting list. > > > > > > "There are 10 types of people in the world: those who understand > > > binary, and > > > those who don't." -Unknown > > > -- > > > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing > > > list > > > To post a message email: RPG400-L@xxxxxxxxxxxx > > > To subscribe, unsubscribe, or change list options, > > > visit: http://lists.midrange.com/mailman/listinfo/rpg400-l > > > or email: RPG400-L-request@xxxxxxxxxxxx > > > Before posting, please take a moment to review the archives > > > at http://archive.midrange.com/rpg400-l . > > > > > > > > > -- > > > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing > > > list > > > To post a message email: RPG400-L@xxxxxxxxxxxx > > > To subscribe, unsubscribe, or change list options, > > > visit: http://lists.midrange.com/mailman/listinfo/rpg400-l > > > or email: RPG400-L-request@xxxxxxxxxxxx > > > Before posting, please take a moment to review the archives > > > at http://archive.midrange.com/rpg400-l . > > > > > > > > > > > > -- > > Mike Wills > > koldark@xxxxxxxxx > > http://mikewills.name > > Want Gmail? Email koldark+gmail@xxxxxxxxx to get on my waiting list. > > > > "There are 10 types of people in the world: those who understand binary, > > and those who don't." -Unknown > > > > > > -- > Mike Wills > koldark@xxxxxxxxx > http://mikewills.name > Want Gmail? Email koldark+gmail@xxxxxxxxx to get on my waiting list. > > "There are 10 types of people in the world: those who understand binary, > and those who don't." -Unknown > -- Mike Wills koldark@xxxxxxxxx http://mikewills.name Want Gmail? Email koldark+gmail@xxxxxxxxx to get on my waiting list. "There are 10 types of people in the world: those who understand binary, and those who don't." -Unknown
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.