REPLACE BINARY example
The following event handler displays a dialog to pick an image file, then stores the contents of that file in a binary field, erasing any previous contents.
PROCEDURE importImageButton_onClick
local cFile
cFile = getfile( "*.bmp", "Image file to import" )
if "" # cFile
replace binary IMAG_FIELD from ( cFile )
endif
GETFILE( ) will return an empty string if no file is selected. In the IF statement, the order of the empty string and the variable cFile is important. If they were the other way around and SET EXACT is OFF, then the IF statement would always be false.
The parentheses are used as indirection operators to get the name of the file from the variable. Without them, dBASE Plus would attempt to append a file named cFile.
The binary type for an image, 32,769, is automatically assigned.