Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6626 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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)

Posted

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?

Posted

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.

Posted

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

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.