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

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

Recommended Posts

Posted

Hopefully this is the right place for this question.

I have a calculation field that results in either a number or a number (e.g. "1.2" with a less than sign in front of it (e.g., "<1.1").  I have the calculation round the number to 1 decimal place.  The calculation works but the if the result is "0.9", the field only displays ".9".  How can I force the field to show the leading zero on the decimal (e.g., "0.9" instead of ".9")?

I can't use the inspector to format the result as a decimal, because that removes all of the values with a less than sign entirely (i.e., a field that should appear as "<1.1" will be displayed as empty.

So my questions: 1) what is going on here? and 2) what can I do to force filemaker to show the leading zero in a decimal number"

This is Filemaker 16 Advanced.

 

Thank you!

Posted
2 hours ago, metamict said:

what is going on here?

Filemaker removes ALL leading zeros from a number - including the first one:

GetAsNumber ( "0.5" )

returns  .5. 

 

2 hours ago, metamict said:

a calculation field that results in either a number or [not] a number (e.g. "1.2" with a less than sign in front of it (e.g., "<1.1"). 

If the result can be either a number or an expression like "<1.1", then you need to set the calculation's result type to Text. And that means you need to format the resulting number yourself, for example by something like:

Int ( result ) & If ( Mod ( result ; 1 ) ; Mod ( result ; 1 ) )

 

Alternatively, you could calculate the number as number only, format the calculation field to display as Decimal, and use another field to show the sign. But that would work well for display only, not for exporting, for example.

 

  • Like 1

This topic is 1841 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.