CTField::GetFieldDefaultValue
Retrieves the current field default value.
Declaration
VRLEN GetFieldDefaultValue(pTEXT& value);
VRLEN GetFieldDefaultValue(CTString& value);
Description
CTField::GetFieldDefaultValue() retrieves the current field default value. If no default value is set CTField::GetFieldDefaultValue() returns zero. You can use CTField::IsFieldDefaultValueSet() method to check if a field default value is set or not. Parameter value receives the content of the field default value.
Return
Returns the number of bytes copied to value parameter. If no default value is available, the returned value is zero.
Example
// check if default field value is 'USA'
try
{
CTString value;
CTField hField = hTable.GetFielld("country");
hField = ctdbGetField(hTable, 5);
if (hField.GetFieldDefaultValue(value) > 0)
{
if (value == "USA")
printf("Default value is USA\n");
else
printf("Default value is not USA\n");
}
else
printf("No default value set\n");
}
catch (CTException &err)
{
printf("GetFieldDefaultValue failed\n");
}
See Also
SetFieldDefaultValue(), GetFieldDefaultValue(), IsFieldDefaultValueSet(), ClearAllFieldDefaultValue(), SetFieldDefaultDateTimeType(), GetFieldDefaultDateType(), GetFieldDefaultTimeType()