|
| [WD21] Weird integer in composite key problem |
| Iniciado por guest, 21,jun. 2018 00:00 - 4 respuestas |
| |
| | | |
|
| |
| Publicado el 21,junio 2018 - 00:00 |
We have a data file (MyDataFile) with several fields, some of them: SCode (Text, String 20) NLineNo (Numeric, Integer +-999 999 999 --> 4-byte) DStartDate (Date, yyymmdd) It also has a composite key: IND_Code_LineNo_StartDate (with all 3 fields of above)
Looking at the data in HFSQL Control Center this index seems to be filled correctly. I even reindexed the table to be sure.
Now I'm trying to access data with this index:
nLineNo is int = 30000 HFilter(MyDataFile,IND_Code_LineNo_StartDate,["S12345",nLineNo,hMinVal], "S12345",nLineNo,hMaxVal]) I'm not getting any result.
This workaround does work and gets me the desired result: HFilter(MyDataFile,IND_Code_LineNo_StartDate,["S12345",hMinVal], "S12345",hMaxVal], "NLineNo="+nLineNo)
I'm now using the workaround, but what is wrong with the first variant?
I even tried using minVal is buffer = HBuildKeyValue(MyDataFile,IND_Code_LineNo_StartDate,"S12345",nLineNo,hMinVal) maxVal is buffer = HBuildKeyValue(MyDataFile,IND_Code_LineNo_StartDate,"S12345",nLineNo,hMaxVal) HFilter(MyDataFile,IND_Code_LineNo_StartDate, minVal, maxVal) In the debugwindow I get the following as values: minVal: "S12345<0><0><0><0><0><0><0><0><0><0><0><0><0><0>0u<0><0><0>" maxVal: "S12345<0><0><0><0><0><0><0><0><0><0><0><0><0><0>0u<0><0>ÿ" On first glance, I would say this is definitely wrong. there should be 30000 instead of 0u. But why?
So has anyone any ideas, what I'm missing?
Thanks a lot for your answer. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 21,junio 2018 - 12:53 |
Hi Christine,
I don't use hFilter because queries are more convenient, but on first glance I see an opening bracket [ missing in your code on the second composite key. If that's a typo only in your post, then I suggest you check if the type of variables matches the type in the database.
Kind regards, Piet |
| |
| |
| | | |
|
| | |
| |
| Publicado el 21,junio 2018 - 12:58 |
Hi Christine,
that may be as simple as your variable declaration...
You are telling us that in your analysis it's an int on 4... But your 'nLineNo is int = 30000' is declared as an int (not an int on 4)...
As a result, the size of your int is going to depend on your working mode (32b/64b)... Specify int on 4 in yor code too and let us know if that solves the problem.
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 22,junio 2018 - 00:00 |
Thanks for your answers. The missing bracket is a typo. I changed the string as I was not sure about what I may share from my data (GPDR is a big topic here).
We only provide a 32b version of our application and are not in the least precise with our ints (I know, that's not the best way to work. I will add that to my list for code quality improvements.)
I did try again with "nLineNo is int on 4", but unfortunately the result is the same. I think, I will create a small testproject and try to reproduce this there. Could it be that the data file or the analysis is corrupt? This idea came to me at this latest test. I will look further and let you know, if I find something. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 22,junio 2018 - 10:11 |
The hBuildKey seems to be padding the Code item with binary zero's to a length of 20 is that ok? edit: I mean is that still the way composite keys work? |
| |
| |
| | | |
|
| | | | |
| | |
|