Is it possible to use views as a datasource. I can only select tables in the data tab. I have several views defined in the database, but they do not show.
Table Views are not supported in the currently release. However, we have had a few customers modified the DADE plug-ins for various database, to add support for view. The TdaSession.GetTableNames method is the responsible for returning the list of available tables.
Another customer using RB and IBExpress just today has sent the following proposed code modification to support Interbase views. Try using this code....
{this is a new line, not Digital Metaphors default, to allow You to make a report based on a View too, rather than just using Tables} lTable.TableTypes := [ttView];
{connection must be active to get table names} if not lDatabase.Connected then lDatabase.Connected := True;
{get list of table names from a table object} if lDatabase.Connected then aList.Assign(lTable.TableNames);
For run-time support you can simply copy daIBExpress.pas from RBuilder\Source to RBuilder\Lib and then recompile your Delphi project.
For Delphi design-time support you must recompile the rbIBE7x package (where x corresponds to the Delphi version that you are using):
1. Select Component | Install Packages and remove the rbIBE7x.bpl package. 2. Open RBuilder\Source\rbIBE7x.dpk and compile the package. When you compile a package in Delphi, a .dcp and .bpl file are generated. Copy the generated rbIBE7x.dcp to RBuilder\Lib and copy the generated rbIBE7x.bpl to Windows\System32. 3. . Select Component | Install Packages and add the rbIBE7x.bpl package.
Comments
Table Views are not supported in the currently release. However, we have had
a few customers modified the DADE plug-ins for various database, to add
support for view. The TdaSession.GetTableNames method is the responsible for
returning the list of available tables.
Another customer using RB and IBExpress just today has sent the following
proposed code modification to support Interbase views. Try using this
code....
File daIBExpress.pas
{---------------------------------------------------------------------------
---}
{ TdaIBXSession.GetTableNames }
procedure TdaIBXSession.GetTableNames(const
aDatabaseName: String; aList: TStrings);
var
lDatabase: TIBDatabase;
lTable: TIBTable;
begin
{get the database}
lDatabase := daGetIBXDatabaseForName(aDatabaseName);
lTable := TIBTable.Create(nil);
lTable.Database := lDatabase;
{this is a new line, not Digital Metaphors default,
to allow You to make a report based on a View too,
rather than just using Tables}
lTable.TableTypes := [ttView];
{connection must be active to get table names}
if not lDatabase.Connected then
lDatabase.Connected := True;
{get list of table names from a table object}
if lDatabase.Connected then
aList.Assign(lTable.TableNames);
lTable.Free;
end; {procedure, GetTableNames}
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Thanks. Will experiment with that, and will await a new version
of RB that fully supports Table views.
Regards,
Stefan.
What steps do I need to follow to recompile after adding that code?
Thanks.
Regards,
Stefan Sebregts.
For run-time support you can simply copy daIBExpress.pas from
RBuilder\Source to RBuilder\Lib and then recompile your Delphi project.
For Delphi design-time support you must recompile the rbIBE7x package (where
x corresponds to the Delphi version that you are using):
1. Select Component | Install Packages and remove the rbIBE7x.bpl package.
2. Open RBuilder\Source\rbIBE7x.dpk and compile the package. When you
compile a package in Delphi, a .dcp and .bpl file are generated. Copy the
generated rbIBE7x.dcp to RBuilder\Lib and copy the generated rbIBE7x.bpl to
Windows\System32.
3. . Select Component | Install Packages and add the rbIBE7x.bpl package.
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com