October 20, 200322 yr 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!
October 20, 200322 yr 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.
October 20, 200322 yr Author The numbers vary in length and size. Final zeroes are always be signficant for this particular purpose.
October 20, 200322 yr 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.
October 21, 200322 yr Author 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!
October 21, 200322 yr Author 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.
Create an account or sign in to comment