May 22, 200322 yr I there any way to have FM calculate the length of a number field that will also count any leading zero digits? Examples of what I'd like results to look like: Number field data: 0012345 w/ length = 7 Number field data: 012345 w/ length = 6 What comes out instead: Number field data: 0012345 w/ length = 5 Number field data: 012345 w/ length = 5 I've tried Length(NumToText(number_field)) and various permutations but can't seem to do this. Even exporting the data to a text (comma delimited, e.g.) file didn't work, as FM stripped the zeros during the export. I suspect this can't be done, but thought I'd check w/ y'all before giving up. -Mike
May 22, 200322 yr Yeah, it looks like the Length() calc will count the leading zeros if it is a text field. This is probably because in math non-decimal leading zeros are ignored. But if it is a text field, you lose your number field type features. I guess a sort-of workaround is to have a calc field = your number field with the result of the calc be text, then have your Length() calc field count this calc text field. Ken
May 23, 200322 yr Why don't you just define the field as text then the Length() function will work. And you can still do math operations on the data. In fact there are very few situations where you really need to define a field as number.
May 23, 200322 yr Author Unfortunately, I'm looking at a solution where the field has already been defined as type = number w/ ~30,000 records worth of data, or I'd definitely go with type=text. And the solution of making a number_text_format field w/ calc (text result) = NumToText (number_number_format) strips off the initial zeros. Nice try, though. -Mike
May 23, 200322 yr Author Success!! All I did was change the field definition for the Number field from type=number to type=text. That was all it took. All the data stayed exactly the same. I was expecting FM to remove all the zero's as part of the field type conversion, which is why I didn't try that earlier. It makes no sense to me why this would work when all the NumToText and export stuff didn't, but there you are. -Mike
Create an account or sign in to comment