Several distinct responses:
1) I hope you didn't really SORT, as in the sort command. It is RARELY
justified and potentially destructive.
2) I don't think this field will, as it stands, produce the order you
want.
You want:
0310
0410
0510
0311
0411
0511
right? This field will produce this:
0310
0311
0410
0411
0510
0511
3) IT'S USABLE AS IS!!
You want to create an index:
INDEX ON RIGHT(cardx5,2) + LEFT(cardx5,2) TAG yearmonth
From now on, just SET ORDER TO yearmonth
4) brow all for cardx5 >= '0311' would give records *after*, not
before. You've got your logic backwards, but this value won't ever work
that way *anyway*. You need to convert it to a date value:
Brow for Date( VAL(RIGHT(cardx5,2)), VAL(LEFT(cardx5,2)), 01) <=
{03/01/11}
5) Since you clearly want to deal with this string value as a date
value, it might pay you to add a date field to the table and populate
it:
Replace All NewDateField with Date( VAL(RIGHT(cardx5,2)),
VAL(LEFT(cardx5,2)), 01)
Dan
Post by gvm920Dan, Thanks that worked.
One other question. Now I am trying to by pass anything that is prior
to 0311 or March 2011.
I tried: brow all for cardx5 >= '0311' and nothing occurred.
I sorted to the file on the cardx5 field, that worked however only
partially as it doesn't do it all.
I wounder is there some way to convert this to a day field type
without wiping out all 5000 records? Or any other suggestions.
Thanks
Howard
Post by Dan FreemanSorry. That should be alltrim() instead of ltrim().
Dan
Post by gvm920Here is the command I used: Replace all carx5 with PADl(Ltrim(carx5),
4,"0")
Post by gvm920Thanks for your assistance Dan. I tried the command and it didn't make
any changes or additions to the field. Please advise.
Howard
Post by Dan FreemanThis is, presumably, existing data.
Replace all YourField with Padl( Ltrim(YourField), 4, "0")
If you're looking for a data entry solution, that's a different
problem.
Dan
Post by gvm920This is probably a simple request for most of you, but I am not sure
I have a field name cardx it is a 4 character field and essentially
1011
0613
910
709
The problem is I want to put a 0 in front of the numbers that have
only 3 numbers. So you understand these are monthyears 1011 = October
201. 910 - September 2010 etc. Without the zero I can't do any proper
queries. Let me know what you suggest.
Thanks for your help.