Column(s) in TDBGrid missing data

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
SteveInIT
Posts: 9
Joined: Wed 22 Apr 2015 17:42

Column(s) in TDBGrid missing data

Post by SteveInIT » Tue 11 Aug 2015 04:45

I am using Delphi XE8, MS SQL Server 2012, and Unidac 6.1.6

I have one table that has two lookup columns. I've tried reverting to regular data columns with the same result. One other Master/Detail grid on the same form has the same issue. I'm using TUniQueries.

Here is the SQL Query from the table having the issue...

Code: Select all

procedure TAdobeLicenseInfo.SetAdobeKeyTBLtoAllRecords;
begin
  With UQAdobeKeyTBL do
    begin
      SQL.Text := 'SELECT * from AdobeKeyTBL ORDER BY AdobeLicIDNo';
      Active := True;
    end;
end;
[code]

.......Here is the SQL Statement from the the first detail table which holds the value for the AdobeLicIDNo column.
[code]
procedure TAdobeLicenseInfo.SetAdobeProductTBLtoFilteredRecords;
begin
  With UQAdobeProductTBL do
    begin
      MasterSource := UDSAdobeLicTBL;
      MasterFields := 'AdobeProductIDNo';
      SQL.Text := 'SELECT * from AdobeProductTBL WHERE AdobeProductIDNo = :AdobeProductIDNo ORDER BY AdobeProductName';
      Active := True;
    end;
end;
The code for the second detail table is as the first. When you go into edit or insert field, the mastersource is disabled and the mastersource and masterfields are set to nil and '' so all records are shown for editing the pick from the fkLookup column. When leaving on the after Post, Cancel, whatever event, I set the mastersource back so the two tables are set to Master/Detail showing only the records needed.

Now here is the kicker....

When the form is shown, there are three records total within the AdobeKeyTBL. Nothing is filtered. Within the two lookup columns, having the first record selected, the two values are there. It looks like this...

(Sorry, four columns, first two are the fkLookups, formatting doesn't hold...)

Adobe License ID No Key Type Column4 Column5
1 Cloud Based dataisthere dataisthere
NOTHING HERE NOTHING HERE dataisthere dataisthere
NOTHING HERE NOTHING HERE dataisthere dataisthere

There *is* data in the 2cd and third record but it is not showing.
If you move to the next record, it still shows only the first record data, however if you click the dropdown box in the column in dsBrowse, the data is listed there, but you cannot select it. This goes for where there is no data showing in the second and third rows. It's still blank in the showing cell.

So I did a test where I made invisible the fkLookup fields and put the data fields back for the respective fields. Same issue, so it doesn't seem to be how the TDBGrid is showing it. I have all fields set persistently in the column editor btw.

If you place the dataset into insert mode, a new row is inserted and you are able to select your data but the other rows are still showing as above. So now you change your mind and hit cancel and ALL THE DATA IS SHOWING. As below...first two columns are the fkLookup columns.

Adobe License ID No Key Type Column4 Column5
1 Cloud Based dataisthere dataisthere
5 Key Based dataisthere dataisthere
6 Key Based dataisthere dataisthere

Now, when you hit the refresh key for the dataset, if the cursor is on the first row, it goes back to what it looked like when the form was shown. If the cursor is on the second row, it will show like below....


Adobe License ID No Key Type Column4 Column5
NOTHING HERE NOTHING HERE dataisthere dataisthere
5 Key Based dataisthere dataisthere
NOTHING HERE Key Based dataisthere dataisthere

This is totally consistent with the records every time. I have tried repainting the grid, deleting and re-adding the TUniQueries and TUniDatasets, adding the persistant fields to both the data components and rebuilding the TDBGrids.

What am I missing here...if refreshing the database does this and the DBGrid only shows what it's handed, are we dealing with a little problem or am I doing something wrong?



Thanks...

Steve

SteveInIT
Posts: 9
Joined: Wed 22 Apr 2015 17:42

Re: Column(s) in TDBGrid missing data

Post by SteveInIT » Wed 12 Aug 2015 13:37

This ended up being a bug and has been reported to Embarcadero. I thought it was something I was doing.

Post Reply