newObjects Active Label Field object

Obtained from the VisiLabel.Variables object:
f = VisiLabel.Variables.Field(x);
f =
VisiLabel.Variables(x);
The Field object implements a data field used by the internal data source - the Variables object to form a recordset-like structure. When the Variables object is navigated through an external data source or the internal cache the data from the current record from the cache or the external source is transferred into the Variables object's fields. From the fields the data can be accessed by the application (usually a script in a DHTML page) or applied to the label drawing objects/elements. 

The Field object has two special properties - Element and Property. They specify the name (Element) and the property name (Property) of the drawing object/element linked to this filed. This way the field is able to change the specified property of the specified element during the navigation through the data. This is invoked by the application (to show the effect visually) and by the VisiLabel.Print method during the printing process (to generate set of labels on the paper - one for each data record).

Text command:

The text commands are used to represent objects and their settings in the saved label data. When the label is saved or uploaded (see How to Download and Upload) text commands are generated and packed in the specified format (see Misc.SaveFormat). The representation of the entire label with its elements can be also obtained programmatically through VisiLabel.TextCommands and VisiLabel.ObjectParams. The commands have simple syntax and can be generated from the application (just like a HTML output) where appropriate allowing the developer implement different tasks in any suitable way. The label can be instantiated from set of text commands (see the list of the different options to do this). The text commands can be feed into the control programmatically (see VisiLabel.TextCommands) or a download can be invoked (see VisiLabel.Src and VisiLabel.MergeSrc).

A Field object is represented by a DATAFIELD text command. See also  CACHEDATA and FIRSTCACHEDATA commands.

Members reference:

Properties
Name Read/Write, String
Sets/gets the field name
Syntax:
f.Name = "MyField";
var str = f.Name;
objVisiLabel.Variables("MyField").Name = "NewNameForTheField";

Remarks:
In Active Label 1.0 the field names are not important for the internal functionality. For example the data supplied by CACHEDATA text commands is distributed in the same order in which it appears (i.e. the first value to the first field, the second value to the second field and so on). The same is true also when working with databases. However the field names can be quite helpful when you need to access them programmatically.
Exclude Not supported in version 1.0
Size Read/Write, long integer
Gets/sets the size of the field. Custom sizes can be set to String fields only.
Syntax:
f.Type = 8; // String
f.Size =44; // 44 characters max
var fldSize = f.Size;
objVisiLabel.Variables("MyField").Size = somesize;

Remarks:
The size must be set when you create string fields, otherwise it is already known from the field type and cannot be actually changed. See also Type.
Type Read/Write, long integer
Sets/Gets the field type.
Syntax:
f.Type = 5; // Make the field of the double precision floating point number type.
var t = f.Type;
var t = objVisiLabel.Variables("MyField").Type;

Remarks:
When in CacheMode changing the field type or size will reset the cache contents.
Element Read/Write, String
Sets/gets the name of the graphical element to which this field is bound.
Syntax:
f.Element = "MyTextLabel";
var elName = f.Element;

Remarks:
The data fields from the Active Label's internal data source are bound to elements on the label by name. This property tells the field which graphical element should be changed when the data is navigated (See also Property).
Property Read/Write, String
Sets/gets the name of the property of the element (see Element) to which this field is bound.
Syntax:
f.Element = "MySimpleTextLabel";
f.Property = "Text";
var prop = f.Property;

Remarks:
One field can be bound to only one element on the label and one property of that element. As the binding is textual - by name the operation does not require you to browse programmatically the entire object model - it is enough to know the names. The bounding can be established from the element's property sheets (Data connection property page). When you want to implement your own data binding user interface or create the bindings in some automatic fashion you use the Element and the Property properties of the Field objects to create the bindings. 
Value Read/Write, Default, Variant
Sets/gets the field's value. When set it causes a script error if the value being set cannot be converted to the field type.
Syntax:
f.Value = "New value";
objVisiLabel.Variables("MyField") = 3;
var val = objVisiLabel.Variables("MyField").Value;

Remarks:
An Empty value can be assigned to any field type. Some languages have reserved word for the empty values (Empty in VB/VBScript). You can use Reset if the language you use does not offer a more convenient way to set the field empty. 
Methods
ShowProperties The method is supported but does nothing in version 1.0 (no property pages are available for the Field objects alone - however they can be edited through the Property sheets of the Variables object).
UpdateObject No need to call this method directly, it is automatically called on each field when the Variables.UpdateLabel is called.
Syntax:
f.UpdateObject(o);
Parameters:
o - an object
Remarks:
Attempts to set the property of the object which is named as specified by the Property to the value contained in the field.
Reset Resets the field value.
Syntax:
f.Reset();
Remarks:
Sets the field empty
ReadObject No need to call this method directly, it is automatically called on each field when the Variables.ReadLabel is called.
Syntax:
f.ReadObject(o);
Parameters:
o - an object
Remarks:
Attempts to read the property of the passed object which is named as specified by the Property into the field's value.

Remarks: 

 

 

 

newObjects Copyright 2001-2006 newObjects [ ]