DXE5, ADS 11.1

Wow. I'm really stumped. Have never needed to do this...

I have a ttAdsVFP table that contains five persistent data fields and four calculated fields. I now realize that I can't edit any of the data fields due to the presence of the calculated fields, or at least that seems to be what I've read in a dozen different places over the last couple of hours researching (on MyTable.Edit an EDatabaseError is thrown "Field (name of one of the regular data fields) cannot be modified") All of the required table updates occur programatically in one procedure. The contents of the calculated fields during the updates are inconsequential. They're required for subsequent display in a grid.

Is this simply not possible, or am I overlooking an obvious solution just because I've never encountered this before? Embarrassing but true.

Any help will be immensely appreciated.

asked 05 Jun '14, 20:58

HFox's gravatar image

accept rate: 33%

Never did that, too. But some ideas:

  1. Use a view instead - the calculation is done on the server and you can use INSTEAD OF INSERT/UPDATE/DELETE triggers to make it editable.
  2. Use two TAdsTable components in your app - one for editing, the other with the calculated fields to display. You can bind them together using the AfterScroll and AfterPost events.

answered 05 Jun '14, 23:58

Joachim%20Duerr's gravatar image

Joachim Duerr
accept rate: 18%

Thanks very much, Joachim! At this stage of learning, I'm completely unfamiliar with views, I've not used SQL at all, nor have I had experience with triggers, yet. As you can probably tell, I'm a really old school developer who's been out of the game for quite some time, but has recently been implored to brush off the cob webs, and fire up the coding brain cells again.

I think, in any case, that I might be able to get my head around option 2. I'll give it a whirl and report back. I really do appreciate the suggestions.

(06 Jun '14, 06:30) HFox


Option 2 was the winner! I created a duplicate set of ADS components accessing the same table file but, of course, didn't define the calculated fields for the second connection. In the update procedure, I closed the table used for grid display, made the updates, closed the edit connection, re-opened the display connection, and everything worked like a charm. For my purposes, I didn't even have to add any new code; just changed the existing code to use the correct set of components at the right times.

Thanks again! The suggestion was truly a sanity-saver.

(06 Jun '14, 14:21) HFox
Your answer to the original question.
If responding to a request for additional information, please edit the question or use the comment functionality.
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 05 Jun '14, 20:58

Seen: 2,935 times

Last updated: 06 Jun '14, 14:21

Advantage Developer Zone Contact Us Privacy Policy Copyright Info

Powered by Advantage Database Server and OSQA
Disclaimer: Opinions expressed here are those of the poster and do not necessarily reflect the views of the company.