Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Im assuming your grid is bound to a datasource component. This datasource is then linked with a TDataset descendant. There are a couple of ways you could acheive the desired filtering of the dataset to display only orderid 47.</p> <p>Firstly, you could set the Datasets SQL property to contain a (server side) SQL query such as:</p> <pre><code>SELECT * from table WHERE OrderID = @OrderID </code></pre> <p>You would also need to create a parameter in the dataset to pass the (changing) value for the required OrderID. So add a new Parameter to the dataset (@OrderID), and then at runtime you can set this parameter value in code, something like:</p> <pre><code>DataSet.Parameters['@OrderID'].Value := ParameterValue; </code></pre> <p>Alternatively, you could also FILTER the dataset (client side) to just show the correct data: Set your SQL property of the dataset to retrive the entire table, something like:</p> <pre><code>SELECT * FROM table </code></pre> <p>And then at runtime you could set the Filter property of the dataset to only get OrderID 47:</p> <pre><code>Dataset.Filter := 'OrderID = '+InttoStr(ParameterValue); </code></pre> <p>Depending on your needs one method may suit better (performance/memory) wise.</p> <p>As Najem has commented, there is also a third method - using a Master-Detail dataset relationship. This method works using two datasets, one is the master of the other. When the master table record is changed, the detail dataset is then filtered using the value defined in the <code>Key</code> or <code>MasterFields</code> property of the M-D relatioship.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload