I'm using VFP 9 SP2 .. didn't choke for me. Do you have any records where the numeric field with the year/month is 0? Maybe that is causing the problem.
Cathy > -----Original Message----- > From: [email protected] [mailto:[email protected]] On > Behalf Of Fred Taylor > Sent: Thursday, March 19, 2009 10:47 AM > To: [email protected] > Subject: Re: VFP9-convert a number to month > > What version of VFP are you using Cathy? I doesn't work with VFP9/SP2. As > soon as you add the "GROUP BY" with the 2nd field, it chokes ("Function > argument value, type, or count is invalid.") > > Fred > > > On Thu, Mar 19, 2009 at 5:27 AM, Cathy Pountney > <[email protected]>wrote: > > > I took your second expression, and switched out fields with stuff in my > > data > > so I could test and it worked just fine for me. I didn't have any group > by > > problem. I did, however, shorten up the expression using MOD() on the > date > > to get the month and I just hard-coded the year because it doesn't matter > > to > > the results: > > > > SELECT client, ; > > "CL"+UPPER(LEFT(CMONTH(DATE(2008,MOD(saleperiod,100),1)),3)), ; > > Sum(Iif(.t.,bprice,00000.00)) ; > > FROM contract ; > > Group By 1,2 ; > > Order By 1,2 > > > > Cathy > > > > > > > > > -----Original Message----- > > > From: [email protected] [mailto:profoxtech- > [email protected]] > > On > > > Behalf Of Sytze de Boer > > > Sent: Wednesday, March 18, 2009 8:49 PM > > > To: [email protected] > > > Subject: Re: VFP9-convert a number to month > > > > > > Thanks Fred > > > I now encounter a problem with the "group and order by" > > > > > > Original goes like this (no problem but I want to refine it) > > > *Select client,"CL"+Upper(Left(Cmonth(invdate),3)), > > > Sum(Iif(trantype='I',ttlamount-(ttlamount*(ppb/100)),ttlamount*-1)) ; > > > *FROM winhst Where Between(saleperiod,psdate1,psdate2) And trantype > $ > > > "CI" And client=windebs.Code Group By 1,2 Order By 1,2 Into Table > &myfile > > > > > > Select > > > client,"CL"+UPPER(LEFT(CMONTH(DATE(INT(saleperiod/100),saleperiod- > > > (INT(saleperiod/100)*100),1)),3)), > > > Sum(Iif(trantype='I',ttlamount-(ttlamount*(ppb/100)),ttlamount*-1)) ; > > > FROM winhst Where Between(saleperiod,psdate1,psdate2) And trantype $ > > > "CI" > > > And client=windebs.Code Group By 1,2 Order By 1,2 Into Table &myfile > > > > > > This causes a problem on the group and order by > > > If I group and order by 1 its ok > > > > > > > > > > > > > > > > > > > > > On Thu, Mar 19, 2009 at 12:53 PM, Fred Taylor <[email protected]> > > wrote: > > > > > > > Here's one way: > > > > > > > > ?CMONTH(EVALUATE("{^"+"yyyy"+"/"+"mm"+"/01}")) > > > > > > > > convert your year and month as needed to character or if they're > > numeric: > > > > > > > > ?CMONTH(DATE(yyyy,mm,1)) > > > > > > > > > > > > On Wed, Mar 18, 2009 at 4:37 PM, Sytze de Boer <[email protected]> > > wrote: > > > > > > > > > Hi > > > > > > > > > > I know how to do cmonth(date()) and various derivatives thereof > > > > > How do convert a number to a month ? > > > > > > > > > > This is be done in a select statement where 1 field is (say 200804 > or > > > > > 200805) > > > > > The numbers are consistent yyyy mm, and I'm only concerned with the > > > month > > > > > > > > > > I appreciate all pointers > > > > > > > > > > -- > > > > > Regards > > > > > Sytze de Boer > > > > > Kiss Systems > > > > > Hamilton, NZ > > > > > Ph: 64-7-8391670, Mob:021 937611, > > > > > www.kiss.co.nz > > > > > > > > > > > > > > > --- StripMime Report -- processed MIME parts --- > > > > > multipart/alternative > > > > > text/plain (text body -- kept) > > > > > text/html > > > > > --- > > > > > [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/002101c9a8a3$7ee5ba10$7cb12e...@com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

