version 6.0
DR AREA TO FIELD (area; scope; table; field{; saveMethod})
| Parameter | Type | Description | |
| area | Longint | 4D Draw area | |
| scope | Longint | -2=Document and setting saved | |
| -1=All objects saved | |||
| 0=Selected object saved | |||
| >0=ID | |||
| table | Integer | Table number | |
| field | Integer | Field number | |
| saveMethod | Integer | 0=Picture and data | |
| 1=Picture only | |||
| 2=Data only | |||
| -1=No change |
Description
The command DR AREA TO FIELD copies the contents of area into the Picture field specified by table and field. If field is not of type picture, DR Error returns error code 31.
scope controls what is copied.
If scope equals -2, the entire document is saved in the Picture field specified by table and field. This includes document settings such as drawing size, ruler settings, and display options.
If scope equals -1, all objects in area are saved in the Picture field, but without document settings.
If scope equals 0, only selected objects are saved in the Picture field.
If scope is greater than 0, it must equal an object's ID, and only that object is saved. If an object with that ID does not exist, DR Error returns error code 2.
DR AREA TO FIELD is useful when you want to store objects in a field of a related table or store only specific objects. DR AREA TO FIELD simply assigns the objects to field. The record in table must still be saved.
The optional saveMethod parameter determines how the document in the 4D Draw area is saved.
If saveMethod equals 0, the default value, both the picture and the internal data used to rebuild the image are saved.
If saveMethod equals 1, only the picture (PICT) is saved. Objects can no longer be manipulated individually.
If saveMethod equals 2, only the data concerning the objects in the 4D Draw area is saved. The image is later rebuilt using the information in the saved data. This save option is quick and uses the least amount of memory. If there is not enough memory, a dialog box that allows you to choose another method appears.
Example
The following example creates a related record for each object in Area.
For($i;1;DR Count(Area;-1)) `Loop for each object CREATE RECORD([Objects]) `Create a record to store the object [Objects]Key:=[Drawings]Name `Assign the relating value $Temp:=DR Get ID (Area;-1;$i) `Get the object's ID DR AREA TO FIELD(Area;$Temp;3;2;1) `Copy the object into the record SAVE RECORD([Objects]) `Save the record End for
See Also