Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
procedure TfrmMainData.DBGrid1CellClick(Column: TColumn);
var
str : String; // temporary storage
si : SmallInt; // loop counter
begin
with DBGrid1 do
begin
if SelectedRows.Count > 0 then
begin
str := '';
With DataSource.DataSet do
for si := 0 to SelectedRows.Count - 1 do
begin
GotoBookmark( pointer( SelectedRows.Items[ si ] ) );
str := str + FieldByName( 'CustNo' ).asString + ', ';
end;
str := copy( str, 1, length( str ) - 2 );
Edit1.Text := str;
end;
end;
end;
procedure TfrmMainData.Button1Click(Sender: TObject);
var
si : SmallInt; // loop counter
sl : tStringList; // temporary storage
begin
sl := tStringList.Create;
try
// First, get the selected ID Values.
with sl, dbGrid1, DataSource.DataSet do
if SelectedRows.Count > 0 then
begin
add( 'where' );
for si := 0 to SelectedRows.Count - 1 do
begin
GotoBookMark( pointer( SelectedRows.Items[ si ] ) );
add( 'o.CustNo = ' +
fieldByName( 'CustNo' ).asString );
if si < SelectedRows.Count - 1 then
add( ' OR ' );
end;
end;
// Now, revise the query
with dmMainData.Query1 do
begin
if active then close;
SQL.clear;
SQL.add( 'select distinct * from orders o' );
SQL.AddStrings( sl );
Open;
end;
finally
freeAndNil( sl );
end;
end;