Page 1 of 1

filtering TMyMetaData

Posted: Mon 15 Sep 2008 09:53
by jkuiper
I'm using TMyMetaData with options columns to show all my tables with columns and definitions. I'm using a filter to select one schema (database), because only one database I want to see. But the filter doesn't work. I even created IndexFieldNames, but it doesn't help.

So how do I filter my data?

Posted: Tue 16 Sep 2008 11:49
by Dimon
If you want to use the Filter property you should set the TMyMetaData.Filtered property to True, like this:

Code: Select all

MyMetaData.Filter := 'TABLE_SCHEMA=''test''';
MyMetaData.Filtered := True;
Also you can use the Restrictions property to provide one or more conditions restricting the list of objects to be described. This is a better way, because filtering is executed on server.
For example:

Code: Select all

MyMetaData.Restrictions.Values['TABLE_SCHEMA'] := 'test';

Posted: Wed 17 Sep 2008 10:49
by jkuiper
I set my filter in the properties in TMyMetaData en set the Filtered to true with no results. But I didn't try the Restrictions, because the help didn't say how to use it.
But I'm going to try it.

Posted: Wed 17 Sep 2008 10:55
by jkuiper
It works, thanks.

Another question about restrictions. Is it also possible to excludes things like tables?

Posted: Fri 19 Sep 2008 10:48
by Dimon
You can specify the table to show information for, like this:

Code: Select all

MyMetaData.Restrictions.Values['TABLE_NAME'] := 'table';
You can use the TMyMetaData.GetRestrictions method to find out which restrictions are applicable to a certain MetaDataKind.