Symptoms
Error on trying to assign a value to the field:
Type 'number' is not assignable to type 'string'
Cause
Field type differs from the type of value that is assigned to the field's value.
Resolution
Try converting the value to the necessary type prior to assigning it to the field.
I.e., if the value needs to be converted to string, use .toString()
method. The method can be used as follows:
Comments
1 comment
Enno Duenkel
I needed it a bit different
I needed to compare the sum of weights to a string field - so my IF condition was the following:
if (parseFloat(Context.GetField("Total weight").Text) - sum == 0) {
...
}
(sum=decimal variable, Total weight = name of the string field)
Please sign in to leave a comment.