Delphi TClientDataset cannot Lookup 15360

I must be doing something wrong - but I just can't see what it is...

I use Delphi XE3 on Win 7.

In TClientDataset (A) I have an integer field which looks up a value from an integer field in TClientDataset (B).

This works just fine UNLESS the value of the integer in (B) equals 15360; in this case nothing shows in the lookup integer field (A). But, if I lookup the same integer and return it to a string field then it works OK.

What is so special about the number 15360?

The attached sample project demonstrates this problem.

500 points if you can put me out of my misery!
TestCDSLookup.zip
plumothyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

atul_parmarCommented:
Seems to work for me. FYI, I tried with Delphi 2007 and Delphi XE on XP.
0
plumothyAuthor Commented:
Thanks for trying it out. I have just tried it in Delphi XE on Win 7 and it works OK.

I will dust off an old machine with BDS 2006 and try that...
0
plumothyAuthor Commented:
It works alright with BDS 2006.

So far, it's just XE3 on Win 7.

Anyone got XE4?
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

plumothyAuthor Commented:
I have done some more testing and discovered that it is nothing to do with Lookup.

You simply cannot assign the number 15360 to a TClientDataset integer field. I have tried FieldByName().Value and FieldByName().AsInteger. All other numbers I have tried are OK - just 15360 (so far) fails.

(InsertRecord([15360]) does work OK.)

The attached project demonstrates this. I use InsertRecord to add a few records which set the field called "X" ranging from 15356 through to 15363. The calculated field called "XCalc" is set to the value of X and the calculated field called "X15360" is set directly to 15360. The value 15360 is never displayed in the grid for columns XCalc and X15360.

I can't believe what I am seeing - there must be an explanation for this.
Test15360.zip
0
atul_parmarCommented:
Is it XE3? If you have source, you can debug and see what is wrong. Also, the issue may be with dbgrid too. Would you use a data bound control e.g. DBEdit to see whether it displays correctly?
0
Guillaume80Commented:
FYI, your test project works well on my machine (Win 7 + Delphi XE2)
0
plumothyAuthor Commented:
Yes, this is Delphi XE3.

It is nothing to do with DBGrid or any other bound control (ie it is not a display problem).

I now have a version of my test project (attached) which has no bound controls at all.

I have discovered that every integer multiple of 256 (including zero) cannot be assigned to an integer field.

Can someone test this in Delphi XE4 (I don't have it)?
Test256.zip
0
plumothyAuthor Commented:
I have just downloaded and installed XE4. It works OK.

It looks like it is just XE3 that fails to assign multiples of 256 to a TIntegerField.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.