October 4, 200619 yr I need to understand better how FMP handles calculation and data type conversion and hope you guys can provide the clarity. Here is the situation... If I use script; SetField(field 1 text type; (field2 text type & (field3 type number – integer))) When field2 = CB Field3 value = 0055 and integer = 5 Why is the result CB50 instead of CB0050? Yet when I do the same thing without the integer subtraction the result is CB0050? TIA, K
October 4, 200619 yr Leading zeroes are ignored in FileMaker arithmatic. If you wish to pad your result, you'll need to treat it as text: Field2 & right("0000" & Field3 - integer; 4)
October 5, 200619 yr Author Ok. Thats what i thought. next question then... how do you explain setting the field type to number and set for auto fill as serial on creation with next increment value 0001 keeps the padding zeros? Is this field actually text then?
October 5, 200619 yr It IS difficult to explain. It really shouldn't be like that. Seems that Filemaker tries to be tolerant and remembers the leading zeros in case you want to use the field in a TEXT calculation. But when the field needs to be evaluated AS NUMBER, the leading zeros MUST be ignored.
October 5, 200619 yr Author Is the calculation precedence / data type promotion hierarchy documented anywhere or we at the mercy of the designers? Kind of like playing pin the tail on the donkey if we are. Kris
October 5, 200619 yr The order of evaluation is standard, and I believe it is documented as well. Type conversions are pretty obvious, according to the operator used and the type of result selected.
Create an account or sign in to comment