Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

DynaPDF.SetFieldExpValue

Changes the choice values of a combo or list box, or to change the state and export value of check box.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 4.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.SetFieldExpValue"; PDF; Field; ValIndex; Value; ExpValue; Selected )   More

Parameters

Parameter Description Example
PDF The PDF reference returned from DynaPDF.New. $pdf
Field The field index or field name. "FirstName"
ValIndex The value index or -1. -1
Value The new value. "Hello"
ExpValue The export value. "World"
Selected Whether to select the value?

Result

Returns OK or error.

Description

Changes the choice values of a combo or list box, or to change the state and export value of check box.
In the latter case, the parameter ValIndex will be ignored. If the field handle refers to a radio button, ValIndex represents the index into the Kids array of the radio button.
To determine how many values are defined in a field call the function DynaPDF.GetFieldExpValCount or DynaPDF.GetField.
The parameter Value is ignored if the field is a check box or radio button. However, the parameter ExpValue is required for these field types.

If you don't need to change the value or export value then use the function DynaPDF.SetFieldExpValueEx instead.
If the field is either a combo box or list box, the parameter ExpValue is optional and can be empty. If the parameter Value is set to an empty string, the choice value will be deleted. Note that all choice values in a combo or list box must be unique. DynaPDF checks whether another choice value with the new name does already exist. If this is the case then the function will fail.
Combo boxes which have the field flag ffEdit set accept a value that was directly typed into the field in a viewer. Such a value may or may not exist the list of choice values. In any case, a special handling is required for this case because the value must be set as the field's value independent of whether it is already included in the list of choice value.
To achieve this, set the parameter ValIndex to PDF_MAX_INT (2147483647) or any index greater than the number of choice values in the field. The parameter Value can also be set to NULL or to an empty string to delete the field's value. If the string is set then it becomes the new field value but it is not added to the list of choice values if not included.
Note that the above handling is only valid for combo boxes which have the ffEdit field flag set.
To enumerate the choice values of a combo box, list box or radio button use the function DynaPDF.GetFieldExpValueEx.

See also SetFieldExpValue function in DynaPDF manual.

See also

Example Databases

This function checks for a license.

Created 18th August 2014, last changed 5th March 2021


DynaPDF.SetFieldDate - DynaPDF.SetFieldExpValueEx