This topic is locked

Queries in dashboard

5/11/2023 5:45:06 AM
PHPRunner General questions
mbintex author

Hi at all,
is there any way to show a list view in a dashboard several times with different queries.
Of course I can do for example four views based on different queries and show these in the dashboard, but that would need a lot of overhead for the views.
Easier would be to show just one list view four times in the dashboard with a different query for each occurence. But I don´t see a way to change the where-clause based on the occurence in the dashboard via SQL event.
I am looking for an easy way to compare data from the same table in a dashboard. For example sales last year and this year. Or transactions on different bank accounts shown next to each other.
Any ideas without creating x views?

Sergey Kornilov admin 5/11/2023

Create additional list pages. Read the additional page name from the URL and adjust the SQL query based on the current page name.

mbintex author 5/11/2023

Thought I tried that.
Got the page name with $get and then had
`

if ( $page=="listerledigt")
{
$strWhereClause="Bearbeitungstatus='Erledigt'";
}
elseif ( $page=="listinarbeit")
{
$strWhereClause="Bearbeitungstatus='In Arbeit'";
{`in the Before SQL query event.
But it didn't work.
And then I thought, well it might not work since the dashboard page URL does not contain the page-parameter of the several lists where they are placed to show up. Isn´t that true?

mbintex author 5/12/2023

ah, thanks for the hint. Guess that getting the page form $pageobject will change the situation
if( $pageObject->pageName == "edit1" ) { }