May 3, 201114 yr 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) )
May 3, 201114 yr 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).
May 3, 201114 yr 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 )
May 3, 201114 yr 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.
May 3, 201114 yr 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.
May 4, 201114 yr 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.
May 4, 201114 yr Author 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
May 4, 201114 yr Author 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 ; "." ) )
May 4, 201114 yr Author 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
May 4, 201114 yr And how about something simple? TextMerge.zip --- BTW, in case you missed my earlier remark: if you do not round the number first, your result will be inaccurate in 50% of the cases on average.
May 6, 201114 yr Author Thanks I like that one and stored that for future use. no doubt I can find a use for it
Create an account or sign in to comment