Tech Tip: Moving contents of blob outside datafile
PRODUCT: 4D | VERSION: 13.3 | PLATFORM: Mac & Win
Published On: December 26, 2013
4D allows the data in a blob and picture field to be saved outside the data file to minimize the used space in the data file. In order to move the contents of the blob outside the datafile, the "Stored" field property must be set to save the data outside the data file first. Then the records must be resaved to allow 4D to move data from the field onto the disk.
Step 1: Setting the "Stored" field property
From the Database Structure window, select the target Blob (or Picture) field and open the field Inspecter by double-clicking on the field. Set the Stored option to outside the datafile.
Step 2: Resaving the records
This process can be done 2 ways:
1. Create a method to resave the records in a specific table
For example:
ALL RECORDS([Table_1]) APPLY TO SELECTION([Table_1];[Table_1]TextField:=[Table_1]TextField+"") |
OR
ALL RECORDS([Table_1]) For($i;1;Records in selection([Table_1])) [Table_1]TextField:=Table_1]TextField+"" SAVE RECORD([Table_1]) NEXT RECORD([Table_1]) End for |
2. Use MSC Advanced Compact to force all records in the data file to be resaved. This process is done by choose Advanced option of MSC Compact, check the Force updating of records checkbox and click on the Compact button. 4D creates a default path for the compacted datafile and the contents of the Blob will be placed in this location.