Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: Eddie Ruiz
  Where is Eddie Ruiz?
 Hawthorne
 United States
 Eddie Ruiz
 Tags
Subject: RE: extracting data
Thread ID: 393937 Message ID: 393943 # Views: 41 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Thursday, December 26, 2013 9:10:01 PM         
   


> >
> >
> > For one, it's a matter of data types, a string comparison works according to the current Collate sequence, so that for example "a" is greater than "0", Command Window example:
> >
? "a" > "0" && .T.
> > 

> >
> > Perhaps you would need to add more info what you want to do exactly -
> > if you want to export numeric types, perhaps only the leading numbers in a string, you could simply use the Val() function, or Int(Val())
> >
> >
? VAL("a") && 0.00
> > ? INT(VAL("a")) && 0
> > ? INT(VAL("7")) && 7
> > ? INT(VAL("7a")) && 7
> > 

> >
> > If you want to handle all numbers in a string, say concatenate them by removing any not-a-number characters, you can use a nested ChrTran() expression
> >
c = "7a7"
> > ? INT(VAL(c)) && do you want 7 or 77?
> > ? CHRTRAN(c, CHRTRAN(c, "0123456789", ""), "")
> > 

> >
> > So that your solution would perhaps be to put an expression that matches your requirements, maybe similar to the previous samples, either into the field list and/or into the For clause of your command - does that work?
> >
> >
> >
> > hth
> > -Stefan
>
> Thank for your suggestions Stefan. If you see the screenshot on the nnum field most of the already extracted data in that field contains numbers (7 digits) but if you see on that same column there's also data that Starts with letters "W" etc... In the code I used above is extracting the data but really want to filter an only export when there's numbers only in that nnum field.
>
> Thanks
>


If the pattern is how the value *starts, you can use the IsDigit() function in your For condition (easier).
If you want to make sure that any character is a number, you can use the ChrTran approach mentioned earlier, something like
... For Empty(ChrTran(c, "0123456789", ""))




hth
-Stefan

ENTIRE THREAD

extracting data Posted by Eddie Ruiz @ 12/26/2013 6:05:37 PM
RE: extracting data Posted by Stefan Wuebbe @ 12/26/2013 7:11:01 PM
RE: extracting data Posted by Eddie Ruiz @ 12/26/2013 8:10:37 PM
RE: extracting data Posted by Stefan Wuebbe @ 12/26/2013 9:10:01 PM