Filter the records of the table view

Archived from the Xataface Users forum.

corestat.consulting — Wed Mar 19, 2008 6:41 am

Hello!

Is it possible to make custom query for the table view?

For example when I click on ‘report’ it prints out all the records found in the ‘report’ table in my database, but how can I filter the shown records by e.x. WHERE date > ‘2008-03-10’?

Thank you for you help,

Benedek RAKOVICS


shannah — Wed Mar 19, 2008 11:17 am

Hi,

There are a couple of strategies you can take here.

  1. Provide a default query for the reports table.

  2. Create a special menu item or link to a filtered version of the reports table.

Both of these strategies take advantage of Xataface’s url conventions.

e.g. if you go to the URL:

index.php?-table=reports&date=>2008-03-10

It will give you what you want.

You can either add a link to this, or add some logic at the beginning of your index.php file to add this query.

Let me know if you want more details.

-Steve


corestat.consulting — Wed Mar 19, 2008 11:51 am

Thank you for you reply!

What I’m actually trying to do is this:

http://wififalu.myip.hu/wifi.jpg

I’m trying to make a new table by getting the ‘telepules’s from the ‘onkormanyzat’ and ‘cko’ tables where levelben=’Igen’. The blue ones are the columns which don’t have any relationship. The first part (where it gets the ‘telepules’s) of the application is the one which is a bit hard for me to understand on how should I do it.

Thanks,

Benedek


shannah — Wed Mar 19, 2008 12:40 pm

OK… so you want to print a report that spans multiple tables.

There are 2 options:

  1. Create a view that meets your report criteria (MySQL 5+).

  2. If you don’t have MySQL 5, then you can create a custom action to print your results.

-Steve