CHeighlund
Programmer
I've been requested to work on a Delphi program designed to process the results from a text file and transform it into a .csv file format. I am not completely certain (I didn't write the program), but it appears that the data is also being sent through an access database as well.
There are three values on each line of the input file, separated by commas. The first is one of three or four types of numeric value (exact type depends on the length of the string, but they're all supposed to be purely numeric), the second is a date string, the last a time string.
I've been given a set of seven files ([name]1 - [name]7) that have thrown errors recently. In the [name]2 file, the numeric field on one of the lines is eight characters long, and the last three characters are 0Z5. Yes, that's a Z; it got placed into the field by accident apparently. That's why this record failed. Thing is, it's not failing the way I'd expect a non-numeric value to fail.
There was a quick and dirty 'isnumeric' function in the code, a try/except block with an inner StrToInt() called on the value passed to it. I've replaced it with the one I use, which looks to see if any of the characters in the string have a chr() value other than in the 48-57 range. Neither of these tests is flagging on the problem code, for some reason. Setting a breakpoint at the first line of the routine shows the code execution appears to be hitting it, but then passing through. And the error when the program finally does blarg is something along the lines of "Syntax error (missing operator) in query expression '0Z5'".
Does anyone have a clue (and is willing to share it) as to why the 'Z' seems to be passing in, or what the error's trying to tell me? The only thing that comes to mind for me is that some languages treat hexadecimal numbers as 0xFFFF format, and I'm wondering if the '0Z' in the string might be getting interpeted similarly somehow. I don't know how likely it is; as I said, it's simply the only thing that comes to mind for me.
Anyone have any idea what's going on here?
There are three values on each line of the input file, separated by commas. The first is one of three or four types of numeric value (exact type depends on the length of the string, but they're all supposed to be purely numeric), the second is a date string, the last a time string.
I've been given a set of seven files ([name]1 - [name]7) that have thrown errors recently. In the [name]2 file, the numeric field on one of the lines is eight characters long, and the last three characters are 0Z5. Yes, that's a Z; it got placed into the field by accident apparently. That's why this record failed. Thing is, it's not failing the way I'd expect a non-numeric value to fail.
There was a quick and dirty 'isnumeric' function in the code, a try/except block with an inner StrToInt() called on the value passed to it. I've replaced it with the one I use, which looks to see if any of the characters in the string have a chr() value other than in the 48-57 range. Neither of these tests is flagging on the problem code, for some reason. Setting a breakpoint at the first line of the routine shows the code execution appears to be hitting it, but then passing through. And the error when the program finally does blarg is something along the lines of "Syntax error (missing operator) in query expression '0Z5'".
Does anyone have a clue (and is willing to share it) as to why the 'Z' seems to be passing in, or what the error's trying to tell me? The only thing that comes to mind for me is that some languages treat hexadecimal numbers as 0xFFFF format, and I'm wondering if the '0Z' in the string might be getting interpeted similarly somehow. I don't know how likely it is; as I said, it's simply the only thing that comes to mind for me.
Anyone have any idea what's going on here?