chemparrot Posted October 20, 2003 Posted October 20, 2003 I have a number field. I have another (calc) field which should return the number of significant figures in the number field. Right now, I count the length of the field and substract any zeroes or decimals. It works great unless I have a number like 0.00980 in the field; the final "0" is significant, but alas my calculation fails! Any ideas on how to trap for a final zero? Or perhaps there is a more elegant approach than my sledgehammer one! Thanks!
DonH Posted October 20, 2003 Posted October 20, 2003 Are you looking for just the significant digits or a set number of significant digits? You seem to be at cross puproses here. The number 0.00980 The final zero is NOT significant. So if you want it, then you need to make your field 5 digits to the right of the decimal point and tell it to fill in the blanks with zeros. Of course that would mean that a number like 1.0 would read 1.00000.
chemparrot Posted October 20, 2003 Author Posted October 20, 2003 The numbers vary in length and size. Final zeroes are always be signficant for this particular purpose.
BobWeaver Posted October 20, 2003 Posted October 20, 2003 The problem is that you must define the number field as a text field. Otherwise, as soon as you try to use the value in a text calculation, the last zeroes will be lost. With the number field defined as text, you can use this formula to get the number of digits to the right of the decimal: Max(Length(NumberField)-Position(NumberField&".",".",1,1),0) PS. There's no disadvantage to defining the field as text. You can still do numeric calculations with it.
chemparrot Posted October 21, 2003 Author Posted October 21, 2003 Yes, you are absolutely correct - and I already had this defined as a text field! I should have mentioned it in my original post. I'd been counting the number of zeroes and the decimal and subtracting that from the length, and of course this didn't count any final zeroes. It didn't occur to me to use the max function, I will try out your calc and see how it works! Thanks!
chemparrot Posted October 21, 2003 Author Posted October 21, 2003 Anatoli, that is indeed an African grey. Her name is Kianga, Swahili for "little light". She is 12 this year and I've had her since she was 7 weeks old. This March she surprised me by laying two eggs and then trying to hatch them (she doesn't, alas, have a boyfriend, but this didn't diminish her determination a bit). More info than you wanted, I'm sure, but there you go.
Recommended Posts
This topic is 7774 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