ID: Q110253
2.50b MACINTOSH
The information in this article applies to:
FoxBASE+ for Macintosh picture fields must be converted to general fields before they can be viewed in FoxPro for Macintosh. Although the FB+Migration application (FoxPro:Goodies:FB+Migrate:FB+Migrate.App) converts FoxBASE+/Mac picture fields to general fields, you may prefer to perform this operation programmatically, as described below.
The following code shows how to convert a FoxBASE+/Mac database with a picture field to a FoxPro database with a general field. NOTE: This program can be run only in FoxPro for Macintosh.
CLOSE DATABASES
* Prompt for Database to convert
filename=GETFILE("DBF","Please locate your FoxBase+ database:")
* Be sure user has selected a database to convert
IF EMPTY(filename)
WAIT WINDOW ;
"No Database Selected to Convert--program terminated" NOWAIT
RETURN
ENDIF
* Open selected database
USE (filename)
basename=ALIAS()
COPY STRUCTURE EXTENDED TO temp
SELECT B
USE temp
LOCATE FOR field_type="P"
IF NOT FOUND()
WAIT WINDOW "No picture fields found--program terminated" NOWAIT
USE
DELETE FILE temp.dbf
RETURN
ENDIF
DO WHILE FOUND()
REPLACE field_type WITH "G"
CONTINUE
ENDDO
SELECT field_name FROM temp ;
WHERE field_type="G" INTO ARRAY fieldlist
USE
* Prompt for name of converted database
fpmgen=PUTFILE("Enter new database name:","PICTURE.DBF","DBF")
IF EMPTY(fpmgen)
WAIT WINDOW ;
"No New Filename Selected--program terminated" NOWAIT
RETURN
ENDIF
CREATE (fpmgen) FROM temp
DELETE FILE temp.dbf
APPEND FROM (filename)
GO TOP
DO WHILE NOT EOF()
FOR x=1 TO ALEN(fieldlist)
APPEND GENERAL (fieldlist(x)) ;
FROM MEMO (basename+"."+fieldlist(x))
ENDFOR
SKIP
SKIP IN (basename)
ENDDO
Additional reference words: FoxMac 2.50b migrate pict general foxbase
convert
KBCategory:
KBSubcategory:
Keywords : kbcode
Version : 2.50b
Platform : MACINTOSH
Last Reviewed: May 21, 1998