Jump to content

Master Detail problem if rowcount unchanged


dpfmp

Recommended Posts

Hi,

I have 2 uniDbGrids in a M/D relationship.

UGrid_Factures is the master table:

procedure THistoriFact_F.UGrid_FacturesSelectionChange(Sender: TObject);
begin
  if Assigned(UGrid_Factures.DataSource) then
  begin
    with UGrid_Factures.DataSource.DataSet do
    begin
      FactLigneTB2.Filtered := False;
      FactLigneTB2.SetRange([Fields[0].AsLongWord,Fields[4].AsInteger],
               [Fields[0].AsLongWord,Fields[4].AsInteger]);
      FactLigneTB2.Filter := 'DateFact >= ' + IntToStr(Trunc(_DtA)) +
                ' and DateFact <= ' + IntToStr(Trunc(_DtZ));
      FactLigneTB2.Filtered := True;
    end;
  end;
end;

Everything  is ok if the number of rows in the FactLigneTB2.SetRange (detail table)  is different than the one from the previous master record.

I've read something related to that but it was back in 2011.  Is this still a known issue?  Is there a workaround?

Thank you,

Denis Prince

D10.1 UniGUi 1.70.0.1486

 

 

Link to comment
Share on other sites

5 hours ago, dpfmp said:

Everything  is ok if the number of rows in the FactLigneTB2.SetRange (detail table)  is different than the one from the previous master record.

I've read something related to that but it was back in 2011.  Is this still a known issue?  Is there a workaround?

Hello,

Can you make a simple testcase for this?

Link to comment
Share on other sites

Hi Sherzod,

Thank you again for your attention,

I have built a very simple testcase that shows the problem.  If you select from the master grid a record that has the same number of detail lines as the previous one, the detail grid does not refresh and the data is related to the previous master record.  

You will need NexusDB database engine ( I use an embedded server ).

If you need more information, please let me know,

Denis Prince

 

TestCase.7z

Link to comment
Share on other sites

Using a Refresh on the detail grid seems to do the trick.

if Assigned(UniDbGrid1.DataSource) then
    with UniDbGrid1.DataSource.DataSet do
    begin
      DetailsTB.SetRange([Fields[0].AsLongWord],
                         [Fields[0].AsLongWord]);
      UniDbGrid2.Refresh;
    end;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...