Subject | Re: [IBO] Help! TDataset in IBO 5.0.2 misbehaving |
---|---|
Author | Chuck Belanger |
Post date | 2012-09-28T20:25:51Z |
Hello:
Below is my work around, but it really is not the answer, because it
requires I add this procedure call to every IBODataset query
Before/AfterPost that is used in the various grids and other controls.
I assume something like this should be going on in IBODataset but isn't.
Jason, could you PLEASE comment; better yet fix this.
work around: add to BeforePost and AfterPost events; uses global array
of variant
procedure TmodData.QryBeforePost(DataSet : TDataset);
var
i: integer;
begin
with Dataset do
begin
AFieldArray := nil;
SetLength(AFieldArray,FieldCount);
for I := 0 to FieldCount-1 do
begin
AFieldArray[i] := Fields[i].Value;
end;
end;
end;
procedure TmodData.QryAfterPost(DataSet : TDataset);
var
i: integer;
begin
with Dataset do
begin
Edit;
for I := 0 to FieldCount-1 do
begin
Fields[i].Value := AFieldArray[i];
end;
Post;
end;
end;
Below is my work around, but it really is not the answer, because it
requires I add this procedure call to every IBODataset query
Before/AfterPost that is used in the various grids and other controls.
I assume something like this should be going on in IBODataset but isn't.
Jason, could you PLEASE comment; better yet fix this.
work around: add to BeforePost and AfterPost events; uses global array
of variant
procedure TmodData.QryBeforePost(DataSet : TDataset);
var
i: integer;
begin
with Dataset do
begin
AFieldArray := nil;
SetLength(AFieldArray,FieldCount);
for I := 0 to FieldCount-1 do
begin
AFieldArray[i] := Fields[i].Value;
end;
end;
end;
procedure TmodData.QryAfterPost(DataSet : TDataset);
var
i: integer;
begin
with Dataset do
begin
Edit;
for I := 0 to FieldCount-1 do
begin
Fields[i].Value := AFieldArray[i];
end;
Post;
end;
end;
> Hello:
>
> I have been using D2007 with FB 2.5 with IBO 4.8.7 with a Woll2Woll
> RecordViewPanel which requires TDataset to add patients to the local DB.
> The patient data is encrypted. Everything has been working fine for over
> a year. Now with IBO 5.0.2 (_b52a update) in XE2, the entered data is
> not posted. Below is the salient code and what I am observing:
>
> WITH qryPatientSession DO
> BEGIN
> //decrypting all encrypted patient fields
> SQL.Add('Select f_str2str(Name_First,' + inttoStr(TV.HPW)+') as
> Name_First,');
> SQL.Add('F_Str2Str(Name_Last,' +InttoStr(TV.HPW)+') as Name_Last,');
> SQL.Add('F_Str2Str(Upper_Name_Last,' +InttoStr(TV.HPW)+') as
> Upper_Name_Last,');
> SQL.Add('F_Str2Str(Address1,'+InttoStr(TV.HPW)+') as Address1,');
> SQL.Add('F_Str2Str(Address2,'+InttoStr(TV.HPW)+') as Address2,');
> SQL.Add('F_Str2Str(City,'+InttoStr(TV.HPW)+') as City, ');
> SQL.Add('F_Str2Str(State,'+InttoStr(TV.HPW)+') as State, ');
> SQL.Add('F_Str2Str(Country,'+InttoStr(TV.HPW)+') as Country, ');
> SQL.Add('F_Str2Str(Postal_Code,'+InttoStr(TV.HPW)+') as Postal_Code, ');
> SQL.Add('F_Str2Str(Phone,'+InttoStr(TV.HPW)+') as Phone, ');
> SQL.Add('F_Str2Str(Email,'+InttoStr(TV.HPW)+') as Email, ');
> SQL.Add('F_Str2Str(Cell_Phone,'+InttoStr(TV.HPW)+') as Cell_Phone,');
> SQL.Add('F_Str2Str(Work_Phone,'+InttoStr(TV.HPW)+') as Work_Phone,');
>
> SQL.Add('PT_ID,');
> SQL.Add('PR_ID,');
> SQL.Add('FIRST_VISIT, ');
> SQL.Add('BIRTHDATE, ');
> SQL.Add('GENDER, ');
> SQL.Add('PT_IMAGE, ');
> SQL.Add('EMAIL_1,');
> SQL.Add('EMAIL_2,');
> SQL.Add('EMAIL_3,');
> SQL.Add('E0_USED,');
> SQL.Add('E1_USED,');
> SQL.Add('E2_USED,');
> SQL.Add('E3_USED,');
> SQL.Add('OTC_RATE,');
> SQL.Add('OTC_VOLUME,');
> SQL.Add('Title');
> SQL.Add('FROM Patients');
> SQL.Add('where (PR_ID = :PractitionerID ');
> SQL.Add('or PT_ID = 1)');
>
> On Add Patient, I INSERT a record and by default the DB (Firebird 2.5)
> adds Name_last = 'Last Name' to avoid possible errors from a blank last
> name field. Fields are replaced during Post and AfterPost event
>
> In ww Record View Panel adding new client, "John Smith"
> Save Patient:
>
> at code:
>
> IF dsPatientSession.State IN [dsInsert, dsEdit] THEN
> BEGIN
> edit;
> FieldByName('pr_id').AsInteger := PractitionerID;
> {when traced up to this point:
> qryPatientSession.FieldByName('Name_Last').asString = 'Smith' before and
> after Post, before AfterPost event for IBO 4.8.7, but for 5.0.2 just
> before the Post, it = 'Smith' but after the POST and before the
> AfterPost event
> it = 'Last Name' the default INSERT value, but not the RecordViewPanel
> value. It appears that all the Dataset values obtained from the RVP are
> lost during the POST.
>
> Nothing gets added to the new table, except the "Last Name" default for
> the Name_Last field.
> }
> Post; //transaction is autocommit
> END;
>
> This appears to be a bug, but if not can someone point out what I am
> doing wrong?
> This is a critical feature in a distributed application, so need fixing
> ASAP.
>
> Thank you,
>
> Chuck Belanger
>
>