eddyb2 Posted January 28, 2009 Author Share Posted January 28, 2009 I have added E to the list for now while I get my head around the other method, works fine for now thanks but agree, not a permanant solution. Could I ask if there is a way so that a negative number that has been rounded to 0.0 does not show in red with brackets? For example 0.31 will round to 0.0, perfect. -0.31 will round to (0.0) in red text. 0.0 should be without brackets and not formatted to red, regardless if it was originally a negative or a positive. If I changed the following line Case ( result < 0 ; TextColor ( "(" & t & ")" ; RGB ( 220 ; 0 ; 0 ) ) ; t ) ) ; To Case ( result <= -0.5 ; TextColor ( "(" & t & ")" ; RGB ( 220 ; 0 ; 0 ) ) ; t ) ) ; Would that work? So anything less than or equal to -0.5 would get rounded to (0.5) anything above would get rounded to 0.0 and show as a positive? Many thanks again, you really have helped me out a lot here. Couldn't have done it without you! Link to comment Share on other sites More sharing options...
comment Posted January 28, 2009 Share Posted January 28, 2009 Hm. I did this on purpose, because that's how Filemaker's formatting would present it (and rightly so, IMHO). Anyway, if you don't want it, you'll need to do: Let ( [ result = << your calc >> ; r = Round ( result ; 1 ) ; a = Abs ( r ) ; t = NumToJText ( Int ( a ) ; 1 ; 0 ) & "." & 10 * Mod ( a ; 1 ) ] ; Case ( result ≠ Filter ( result ; "-+0123456789.eE" ) ; result ; r < 0 ; TextColor ( "(" & t & ")" ; RGB ( 220 ; 0 ; 0 ) ) ; t ) ) Is it "E" or "e"? Filemaker's help is ambivalent on this. I see an "e" when I enter a very small/large number - could be a platform thing. Better include both, since the Filter() function is case-sensitive. Link to comment Share on other sites More sharing options...
comment Posted January 28, 2009 Share Posted January 28, 2009 And while at it, why not make it a bit more efficient: Let ( result = << your calc >> ; Case ( result ≠ Filter ( result ; "-+0123456789.eE" ) ; result ; Let ( [ r = Round ( result ; 1 ) ; a = Abs ( r ) ; t = NumToJText ( Int ( a ) ; 1 ; 0 ) & "." & 10 * Mod ( a ; 1 ) ] ; Case ( r < 0 ; TextColor ( "(" & t & ")" ; RGB ( 220 ; 0 ; 0 ) ) ; t ) ) ) ) Link to comment Share on other sites More sharing options...
librone Posted January 29, 2009 Share Posted January 29, 2009 Just for fun, here's a rather simple way to simulate alignment by data type: text is aligned to left, date/time to right, and numbers by decimal point. Ann Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 5537 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