ConvertToField Method
Changes a field from one type to another and returns the object specified in the Type parameter.
expression.ConvertToField(Type)
expression Required. An expression that returns one of the objects in the Applies To list.
Type Required FpFieldType. Specifies the type of field to which to convert the specified field.
FpFieldType can be one of the following FpFieldType constants.
fpFieldAttachments | Returns a ListFieldAttachments object. |
fpFieldChoice | Returns a ListFieldChoice object. |
fpFieldComputed | Returns a ListFieldComputed object. |
fpFieldCounter | Returns a ListFieldCounter object. |
fpFieldCurrency | Returns a ListFieldCurrency object. |
fpFieldDateTime | Returns a ListFieldDateTime object. |
fpFieldFile | Returns a ListFieldFile object. |
fpFieldInteger | Returns a ListFieldInteger object. |
fpFieldLookup | Returns a ListFieldLookup object. |
fpFieldMultiLine | Returns a ListFieldMultiline object. |
fpFieldNumber | Returns a ListFieldNumber object. |
fpFieldRatingScale | Returns a ListFieldRatingScale object. |
fpFieldSingleLine | Returns a ListFieldSingleLine object. |
fpFieldTrueFalse | Returns a ListFieldTrueFalse object. |
fpFieldURL | Returns a ListFieldURL object. |
Remarks
The following chart specifies whether one field type can be converted to another field type and how the conversion works if special conversion is necessary.
From Field/ ToField | Text | Choice | Note | Note (Rich Text Enabled) | Number | Currency | DateTime | Boolean | Multi-valued choice |
---|---|---|---|---|---|---|---|---|---|
Text | N/A | Yes | Yes | Yes | Yes; converts numbers and sets other values to NULL | Yes; converts numbers and sets other values to NULL | Yes; converts dates and sets other values to NULL | No | Yes |
Choice | Yes | N/A | Yes | Yes | Yes; converts numbers and sets other values to NULL | Yes; converts numbers and sets other values to NULL | Yes; converts dates and sets other values to NULL | No | Yes |
Note | Yes; converts and truncates text to less than 255 characters. | Yes; converts and truncates text to 255 characters. | N/A | Yes | Yes; converts numbers and sets other values to NULL | Yes; converts numbers and sets other values to NULL | Yes; converts dates and sets other values to NULL | No | Yes; converts numbers and sets other values to NULL |
Note (Rich Text Enabled) | No | No | Yes | N/A | No | No | No | No | No |
Number | Yes | Yes | Yes | Yes | N/A | Yes | No | Yes; converts zero and under to False and greater than zero to True. | Yes |
Currency | Yes | Yes | Yes | Yes | Yes | N/A | No | Yes; converts zero and under to False and greater than zero to True. | Yes |
DateTime | Yes | Yes | Yes | Yes | No | No | N/A | No | Yes |
Boolean | Yes; converts to 0 or 1. | Yes; converts to 0 or 1. | Yes; converts to 0 or 1. | Yes; converts to 0 or 1. | Yes; converts to 0 or 1. | Yes; converts to 0 or 1. | No | N/A | Yes; converts to 0 or 1. |
Multi-value choice | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | N/A |