Use the setFieldValue method to set the value of an application Data item. This takes two parameters, the name of the Data item and its new value.
Dim iResult as Integer iResult = MvarCurrentIspec.setFieldValue("CUSTNAME", _ txtCustName.Text)
This statement sets the field called CUSTNAME on the current Ispec to the data value of the fieldtxtCustName.Text. After the statement has been executed, CUSTNAME contains a response code indicating whether the field was set correctly or not. Possible value at this point are:
Value | Description |
---|---|
100 | Value updated successfully |
932 | The field name specified does not exist on the Ispec |
933 | The new value is not valid, for example, trying to set a numeric field to an alpha value |
Note: If you generate “getters and setters”, you should be able to access the fields as if they are attributes of the Ispec objects. The COM interface automatically converts them to the appropriate call, for example mvarCurrentIspec.CUSTNAME = txtCustname.Text Take care however, as there is no return code when you use this method.
If a 933 error is returned, you can call a method that provides a more detailed reason for the failure, as shown in the following example:
Dim iRreason as Integer iReason = mvarCurrentIspec.getLincFieldExceptionReason()
The current reason codes defined in the LincFieldExceptionReasons class are shown in the following table:
Value | Description |
---|---|
666 | No reason given |
200 | The field is not numeric, but you are trying to set it using a numeric method |
205 | You are trying to set a read-only field |
210 | The data is too long for the field |
215 | You cannot set an unsigned field to a negative value |
220 | The data supplied is not a number |
225 | The number supplied is infinite |
230 | The number supplied is too big for the field |
235 | The number supplied contains an invalid character |
240 | There are too many decimal digits |
245 | The separators are in the wrong position |