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

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

Recommended Posts

Posted

Hi again

First of all the calculation result is TEXT.

I have tried the Round command but cannot get this to work. Would any one have any ideas on this? At the moment, I have something like 12 decimal places and need to report this on the layout as only 3 or 4 significant figures. It is turning into a bit of a pain!!!

Thanks all

Let (

val = Cosmet2010::Margin of Safety [zz__kf__Cosmet2009RepNum];

Case (not IsEmpty (val); zz__Tab__g & "Margin of Safety Adult 60kg: " & zz__Tab__g & val)

)

Posted

Try putting the calc in the Data Viewer, but set it up like this:

Let ( [

rep = zz__kf__Cosmet2009RepNum ;

val = Cosmet2010::Margin of Safety [rep];

roundval = Round( val ; 3 ) ;

tab = zz__Tab__g ;

text = "Margin of Safety Adult 60kg: "

result = Case (not IsEmpty (val); tab & text & tab & roundval )

] ;

result

)

Then you can try swapping out "result" with the other variables to determine where the problem is ("cannot get this to work" is a little vague).

Posted

Depends...when you say significant digits, do you mean you want "3" to show up as "3.000"?

I think you may need something a little more complicated.

Try this...

Let([

start = Cosmet2010::Margin of Safety [zz__kf__Cosmet2009RepNum] ;

integer = int ( start ) ;

decimal = start - integer ;

decimal1 = Substitute ( decimal ; "." ; "") ;

decimal2 = Left ( decimal1 & "000" ; 3 ) ;

result = integer & "." & decimal2

];

result

)

Posted

The question is indeed not clear. The term "significant figures" has a very precise meaning and I am not at all sure that's what you need.

If you only want to format a number to a fixed number of decimal digits, try:


Let ( 

r = Round ( number ; 3 ) 

;

Int ( r ) & SerialIncrement ( ".000" ; Mod ( r ; 1 ) * 10^3 ) 

)

Note that this assumes non-negative numbers.

---

D J, try 0.0009.

Posted

I like it. Here's a less mathemagical method:

Let (

r = Round( number ; 3 ) + .0001 ;

Int( r ) & Left( Right( r ; 5 ) ; 4 )

)

Also assumes non-negative numbers, but could be modified pretty easily to deal with that.

Posted

mathemagical

LOL. If you prefer to do it with text functions, how about =

Let ( [

r = Round( number ; 3 ) ;

t = SerialIncrement ( "0000" ; r * 1000 )

] ;

Replace ( t ; Length ( t ) - 2 ; 0 ; "." ) 

)

This, BTW, will work with negative numbers, too.

Posted

Thanks all I am still working through each idea . The issue with the first one which I should have made clear was that this has a label command. I have attached a screenshot. Basically I would like the phrase 'Margin of safety:' to prefix each number and you can see form teh screen shot that when I add in the new text for 'margin of safety', the labelling prefix disappears. I have yet to try for 'margin of safety baby' etc

Thanks

Filemaker.bmp

Posted

So how do I incorporate all of that below into my 'margin of safety' text. I am not a filemaker pro like you lot!

Let ( [

r = Round( number ; 3 ) ;

t = SerialIncrement ( "0000" ; r * 1000 )

] ;

Replace ( t ; Length ( t ) - 2 ; 0 ; "." )

)

Posted

Genius. That worked!!! Phew

Let([

start = Cosmet2010::Margin of Safety [zz__kf__Cosmet2009RepNum] ;

integer = Int ( start ) ;

decimal = start - integer ;

decimal1 = Substitute ( decimal ; "." ; "") ;

decimal2 = Left ( decimal1 & "000" ; 3 ) ;

result = "Margin of Safety Adult 60kg: " & integer & "." & decimal2

];

result

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