Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 7912 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I am working with credit card numbers. I want to limit who can see the entire number, and so after it's been entered and validated, people should see only the FIRST 4 digits, plus 3 dots, plus the LAST 5 digits.

I have defined a text field calculation so: Left(creditcardtext, 4) & "..." & Right(creditcardtext, 5)

Here's what I get:

1234123412341234 the original credit card number, in number field

but when I use the Left and Right functions:

1234...41230 Left(CCnum, 4) & "..." & Right(CCnum, 5)

so, I thought I'd check what the number field looks like as a text field. Sure enough,

1234123412341230 CCtext calc'd as NumToText (CCnum) AND

1234...41230 Left(CCtext, 4) & "..." & Right(CCtext, 5)

So my question is - why does the number get rounded when converted to text? How can I prevent this?

-mlplouff

Posted

Hello mlplouff,

Your problem stems from the fact that in FileMaker:

"all numbers are converted to 64 bit extended floating point with precision of 15 digits including both before and after decimal positions"

(ref: FMI TechInfo KnowledgeBase article no 107472, "Technical Specifications Of FileMaker Pro 5.5", http://www.filemaker.com/ti/107472.html )

Thus, all numbers and numeric results of a precision greater than 15 are therefore rounded to 15 significant figures, whenever they are referenced or rendered by calculation.

This is one of several reasons why credit card numbers are normally entered and stored as text. Another reason is that their *meaning* is not numeric, even though they may contain only numerals.

Text fields are for alphanumeric strings of all kinds - and credit card 'numbers' are an alphanumeric string (rather than a number value) which just happens to contain no alpha characters. So, for example, you are rather less likely to start performing arithmetic with them than you are to apply text manipulation functions (such as Left( ) and Right( ) for example...).

I'd therefore recommend that you change your CCnum field to a text field. In the unlikely even that you find to need to start doing arithmentic with it, you can reference the field using TextToNum(CCnum) (though of course, as soon as you do, the rounding to a prescision of 15 will again be applied). wink.gif

Posted
In the unlikely even that you find to need to start doing arithmentic with it...
not so unlikely if you calc a checksum to validate. but you would do this arithmetic on substrings only ...

This topic is 7912 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.