I have a memory structure which is (pretty much) static and read-only. I would like to present its data as a TDataSet descendent to enable me to use DB grids etc to view / report the data. I have no need of editing (in fact this must be prohibited). I've see this SO question and other advice that some home-rolled code 'has problems with bookmarks'. I really only want a simple solution and ideally this would be where I could create a simple 'virtual' table with my known field types and then be given an 'OnGetFieldData' event for each one. My other choice is to use a DevExpress TDxMemData in-memory table and populate it on changes in my data but this is less efficient and more messy. Is there any other solution?
Asked
Active
Viewed 675 times
1 Answers
1
Don't use TDataSet descendant, use LiveBindings instead. Your situation is exactly what they were created for. Here are some videos about their use: http://www.embarcadero.com/coderage/sessions

Torbins
- 2,111
- 14
- 16
-
Ah. That's interesting. I'll try that. Thanks. – Brian Frost Jul 08 '12 at 11:52
-
Well, I've tried the LiveBindings approach and I've learnt a lot but it does not solve my dilemma. I can fake a TDBGrid to display 'alternate' text (taken from my memory structure as required) but I need to make this faking happen at a lower level - the TDataSource or the TCLientDataSet because I want consumers of the data (eg FastReport) to see my changes. I HAVE got a solution by using the GetText event of a the field to intercept the call and insert my data but I have to Refresh the table to get it called. – Brian Frost Jul 13 '12 at 08:08
-
If TDataSet descendants are the only way to insert data in components you need, then LiveBindings won't help. – Torbins Jul 13 '12 at 12:45
-
Yes. My best solution so far is to use calculated fields and hold a key to a specific object in a hidden record field. That seems to work. – Brian Frost Jul 14 '12 at 13:24