 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Stefan Frank Guest
|
Posted: Wed Oct 08, 2003 10:25 am Post subject: Simple question about nTier (DataSnap) |
|
|
Hello!
I have a simple question about multi-tier (DataSnap).
I have a TTable, containing customer data, on the server.
On the client I want to show one of the fields unpacked into three different
data controls. When the user change the data in one (or all) of the three
controls, all three will be packed back to the one field in the server (db).
How do I achieve that and where shall the pack/unpack take place? In the
server, middle tier or the client?
Is custom methods the only way?
Or, isn't DataSnap the right solution for this?
Thanks in advance!
Stefan
|
|
| Back to top |
|
 |
Bill Todd Guest
|
Posted: Wed Oct 08, 2003 2:19 pm Post subject: Re: Simple question about nTier (DataSnap) |
|
|
The best solution would be to normalize the data. Otherwise you will
have to write code to parse the data in the field. The AfterScroll and
BeforePost event handlers should work for this.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
| Back to top |
|
 |
Dave Rowntree Guest
|
Posted: Wed Oct 08, 2003 2:37 pm Post subject: Re: Simple question about nTier (DataSnap) |
|
|
"Stefan Frank" <stefan_frank (AT) yahoo (DOT) com> wrote:
| Quote: | I have a simple question about multi-tier (DataSnap).
I have a TTable, containing customer data, on the server.
On the client I want to show one of the fields unpacked into three different
data controls. When the user change the data in one (or all) of the three
controls, all three will be packed back to the one field in the server (db).
How do I achieve that and where shall the pack/unpack take place? In the
server, middle tier or the client?
|
If you have the choice, you might want to concider an alternative to
the BDE, since it has been depricated.
Probably the easiest way to do this is on the client app. Not exactly
how it should happen in an n-tier app, but, as I say, probably the
easiest way.
Add three InternalCalc fields (D1,D2,D3) to the CDS. In the
CDS.OnCalcFields event put the unpack code; something like this:
if DataSet.State = dsInternalCalc then
begin
DataSet.FieldByName('D1').AsString :=
Copy(DataSet.FieldByName('Details').AsString,1,5);
DataSet.FieldByName('D2').AsString :=
Copy(DataSet.FieldByName('Details').AsString,6,5);
DataSet.FieldByName('D3').AsString :=
Copy(DataSet.FieldByName('Details').AsString,11,10);
end;
D1,D2,and D3 should then display the appropriate values. Create a
common OnChange event for all three InternalCalc fields containing the
pack code; something like this:
ClientDataSet1Details.Value := ClientDataSet1D1.Value +
ClientDataSet1D2.Value + ClientDataSet1D3.Value;
And that's it.
--
Dave Rowntree
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|