Kris M Posted October 4, 2006 Posted October 4, 2006 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
Ender Posted October 4, 2006 Posted October 4, 2006 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)
Kris M Posted October 5, 2006 Author Posted October 5, 2006 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?
comment Posted October 5, 2006 Posted October 5, 2006 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.
Kris M Posted October 5, 2006 Author Posted October 5, 2006 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
comment Posted October 5, 2006 Posted October 5, 2006 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.
Recommended Posts
This topic is 6626 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now