Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Values changing to exponents, making them look the same

Status
Not open for further replies.

thatgirl100

Technical User
Oct 19, 2005
18
0
0
CA
Hi There,

I am trying to encrypt a list of unique patient health card numbers and I am having trouble because there are many cases where 2 or more different health card numbers are being encrypted with the same exact string.

In order to run my encryption program, the health card numbers need to be CHAR(12). They cannot have leading zeros, so first I need to turn them into numbers. My problem is that when I turn them back to strings, the health card numbers that are 11 or 12 digits long are turned into exponents (1.000E +10). Therefore, the HCNs 10001234123 and 10004567456 will both be turned into 1.000E +10 and then once they are encrypted they will look like the exact same value. Can anyone think of a way to avoid them turning into exponents? I tried creating a field of datatype "Float" and making it extra long but this did not work either as soon as I turned the numbers into strings.

Thanks so much.
 
Try this to convert your HCNs for input to your encryption program.
Code:
m.cHCN = PADL(INT(VAL(HCN)),12,SPACE(1))
Regards,
Jim
 
The answer depends in part on how you are converting the numbers back to strings. If you are using STR(), with only one parameter, you will get exponential format.

But if you use TRANSFORM(), or if you use STR() with a high number in the second parameter (higher than the number of digits), you should get the normal decimal representation.

By the way, the float data type doesn't really exist as such in FoxPro. It is just a synomym for numeric. To get floating point, you would use Double. But I don't think that's relevant in this case.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top