- This topic has 3 replies, 2 voices, and was last updated 8 years, 11 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
Integrated Application Platform
Integrated Application Platform › Forums › General › Key Control: not handling numbers
Hi,
It appears that KeyControl doesn’t handle fields with numbers
When used inside an Access, if Keycontrol has to lookup a field that contains numbers, then it always reports Invalid: keycontrol field name. You need to convert it to string if you need to use KeyControl with errors.
Not sure if this is a conscious design or bug.
ajith
Looking at the code for the control, it appears it is trying to handle data types other than string. I will have a closer look and let you know what I find.
I have done some more testing and confirmed that some of our applications actually do use KeyControl with number fields and it is working.
One thing to check is that you have the proper datadict class attached to your field and inherit from an appropriate base class that will do the proper encode for the data type you are using. For example, the field that I tested with defined the Control member as a KeyControl, and inherited from Field_number, which will ensure the values get encoded as numbers. When I switched the datadict class to inherit from Field_string, I saw behavior similar to what you described.
Hi,
Your explanation is correct. The data dictionary mismatch was probably the problem. The table that the KeyControl used did not have any data dictionary defined. It was an imported table just for the list. I had assumed that every field would be treated as string. However this particular field contained only numbers and so Suneido treated it as numbers (I checked for the type of data it was Number). However, the field for which KeyControl was defined as its control, was defined as string. So, the mismatch.
Thanks,
ajith