Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread Views with Filter - Problem
Mon, Aug 17 2015 12:53 AMPermanent Link

Martin Pflug

Hi all,

i have a problem with filter on views.
For example:

i have a table with cars. Now i created a view (in EDBManager) to show only the black cars.

- select * from cars where color = 'black' -

In my application i connect the view to an EDBTable. And it shows only the black cars. That's OK

Now i want to filter only the sportcars.
- Table(View).filter := 'typ = 'sportcar'' -
- Table(View).filtered := true -
Now i have only black sportcars. That's OK

But, if i want to go back
- Table(View).filtered := false -
Now i have all cars in all colors. Where is the view with "only black cars"? That's NOT OK

What i am doing wrong?

Please give me a help.
Many thanks

Martin
Mon, Aug 17 2015 11:44 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Martin,

What version of EDB are you using?
Also, are you sure that you aren't using the base table instead of the view ?
Can we have the CREATE VIEW SQL, as well as the exact OP code you are using to set/unset the filters please ?


--
Fernando Dias
[Team Elevate]
Mon, Aug 17 2015 1:02 PMPermanent Link

Martin Pflug

Fernando,

>> What version of EDB are you using?
first i had the problem with 2.18 Build x. Then i updated to the newest 2.19 Build 3 with the same result.

>> Also, are you sure that you aren't using the base table instead of the view ?
Yes, i'm sure.

>> Can we have the CREATE VIEW SQL, as well as the exact OP code you are using to set/unset the filters?
I've created the view in EDBManager. But i change it when my application starts. At my first post i used an example. OK, here is (not an example) some code


ZENTRA_BASE_SQLQuery.SQL.Clear;
ZENTRA_BASE_SQLQuery.SQL.Add('ALTER VIEW  GeraetUserView AS');
ZENTRA_BASE_SQLQuery.SQL.Add('SELECT * from geraet where ShowItOnly in (0,102)');
ZENTRA_BASE_SQLQuery.Prepare;
ZENTRA_BASE_SQLQuery.ExecSQL;


It works fine. I can see that other rows are'nt visible. Also the RecordCount is correct. For the filter i have a lot of code. Here is one:
(GeraetTable ist the EDBTable that i have connected with the view)

GeraetTable.DisableControls;
GeraetTable.Filter := 'geraeteart_id = ' + GeraeteartTableGeraeteart_ID.AsString;
GeraetTable.Filtered := true;
GeraetTable.EnableControls;

It works fine, i have only the filtered rows from the select in the view. And the RecordCount is correct.


Unset the filter is only:

GeraetTable.filtered := false;

And now there are ALL rows visible. And the RecordCount  ... show all rows of the table!
Tue, Aug 18 2015 6:08 AMPermanent Link

Adam Brett

Orixa Systems

Fernando,

Can I suggest that rather than using an EDBTable you use instead an EDBQuery with the SQL.Text = 'SELECT * FROM [YouViewName]'

Then try applying the filters and cancel-filters to this Query rather than the table.

I use the exact method you describe, but I always use a Query component and it works fine.
Tue, Aug 18 2015 6:37 AMPermanent Link

Martin Pflug

Adam,

thank you.
I will check this, but i think it's not possible.
My application is a really big one and based on a lot of tables. All bound with edbTables, DBGrids, DBFields and so on.
Tue, Aug 18 2015 10:23 AMPermanent Link

Terry Swiers

Hi Martin,

> What i am doing wrong?

I don’t think you are doing anything wrong as I can reproduce this here on
my side.  Definitely unexpected behavior.

I'll submit a bug report with step by step instructions later today.

---------------------------------------
Terry Swiers
Millennium Software, Inc.
http://www.1000years.com
http://www.atrex.com
---------------------------------------

Tue, Aug 18 2015 12:21 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Terry,

No need - Martin submitted one and I'll be adding a fix soon.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Aug 18 2015 12:46 PMPermanent Link

Martin Pflug

Hi,

thanks to all.
Now hopeful i wait to the coming update
Tue, Aug 18 2015 2:08 PMPermanent Link

Terry Swiers


> No need - Martin submitted one and I'll be adding a fix soon.

Thanks Tim.

---------------------------------------
Terry Swiers
Millennium Software, Inc.
http://www.1000years.com
http://www.atrex.com
---------------------------------------

Image