Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid searching again......but for numbers and dates.
Message
De
25/05/1997 05:10:49
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
23/05/1997 16:38:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00033418
Message ID:
00033572
Vues:
37
> > > Recently there was a thread on searching in grids. Most replies point > > one in the direction of "ingrid" a VCX that is in the public domain. I > > don't use ingrid, but the concepts are similar. I can do the text > > searching just fine for text columns, but am having difficulty with > > numbers and dates. The indexes for these columns are text so I know > > I've probably got to do some datatype converting....but any ideas on > > this would be appreciated. > > > I had a similar problem with Visual MaxFrame and dates. The best answer > I could come up with without rewriting the supplied code was to index on > DTOC(,1), which gives the correct order, and require the User > to input the search string in the format YYYYMMDD (I put a reminder > message on the form for them). > > Kevin I'm porting my incremental search routine to a grid, and there I had a keyed-to-date conversion routine. I think this part of code should work fine... well, it did in FPD :). The purpose of the routine is to build a proper date from as few digits of the date as possible. Its drawback is that it requires the user to key the date in the yymmdd format. Using other formats should require some chopping and rearranging of the received string. Furthermore, if user typed "may" or any other three letter month, the month portion could be filled in etc. FUNC s2d PARA _st Local _sd, _sc, _z, _d * filter out all non-digits _st=strfilter(_st,"0123456789") * save settings _sd=SET("date") _sc=SET("cent") SET CENT ON * in a couple of years this'll need rethinking: _z="19010101" _z=STUFF(_z,3,LEN(_st),_st) _d=CTOD(TRAN(_z,"@R 9999.99.99")) * restore SET DATE &_sd SET CENT &_sc RETU _d

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform