Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to obtain field type
Message
From
11/05/2005 05:38:18
 
 
To
10/05/2005 17:31:11
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
OS:
Windows Server 2003
Database:
MS SQL Server
Miscellaneous
Thread ID:
01012618
Message ID:
01012750
Views:
26
You can replace VB code like this:
SELECT YourVFPCursorName
SCAN
   FOR i = 1 TO FCOUNT("YourVFPCursorName")
       cFldName = "YourVFPCursorName."+FIELDS(i)
       DO CASE
          CASE ISNULL(&cFldName) AND TYPE(cFldName) $ "DT" && Date "D" and DateTime "T" Types
               REPLACE &cFldName WITH {}                  
          CASE ISNULL(&cFldName) AND TYPE(cFldName) $ "NY" && Numeric "N" and Money "Y" Types
               REPLACE &cFldName WITH 1                    && (I don't know what is the difference between 8 and 7 types in VB)                                                       
          CASE ISNULL(&cFldName) AND TYPE(cFldName) $ "CM" && Character "C" and Memo "M" Types
               REPLACE &cFldName WITH ""                
      ENDCASE
  ENDFOR
ENDSCAN
or whith less code (I didn't say it is faster :o):
SELECT YourVFPCursorName
FOR i = 1 TO FCOUNT("YourVFPCursorName")
    cFldName = "YourVFPCursorName."+FIELDS(i)
    DO CASE
       CASE TYPE(cFldName) $ "DT" && Date "D" and DateTime "T" Types
            REPLACE &cFldName WITH {} FOR ISNULL(&cFldName) ALL
       CASE TYPE(cFldName) $ "NY" && Numeric "N" and Money "Y" Types
            REPLACE &cFldName WITH 1  FOR ISNULL(&cFldName) ALL                                           
       CASE TYPE(cFldName) $ "CM" && Character "C" and Memo "M" Types
            REPLACE &cFldName WITH "" FOR ISNULL(&cFldName) ALL                                          
      ENDCASE
ENDFOR
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform