How to have auto updating filters in the dashboards


#1

Hi, I have a dashboard representing the build performance and break downs of each test runs . The current work flow for me to get the latest build results is when I goto the filter in the dashboard > select the latest build > Add filter > dashboard is populated .
Now my question is how can I get the latest always to display on the board . I have tried to sort by ascending ,etc still not what I expect . Is this something that has to be dealt at my DB level or can metabase can help.
Thanks in Advance.


#2

It’s not very clear what you’re trying to do. Can you provide some pictures?


#3

Hey , I was referring to this guy

How can I get the latest build auto populated on its own , I mean in this case if I can have a option in the filter like descending etc on the dashboard.

The current situation is my dashboard is not automated it requires human intervention to keep changing the filter to the latest build to get meaningful build information on the dashboard.

Please let me know if my query is still not making any sense.


#4

Do you want the user to select, or just have the latest build automatically? Personally, I’d use a view with a WHERE clause of WHERE build = (SELECT MAX(buidl) from wherever))


#5

I want to have the latest build automatically , Im not a SQL pro could you please explain me a bit more on how to utilize this clause . Also In context of creating a auto populating dashboard . Would it mean create a where clause once an create multiple widgets of my requirement based on the SQL querry ?.


#6

It’s hard to explain without having access the database.
Easiest approach would be to have a view on the database that just returns the latest build. Link that view to the table you’re already using.
I think you’re going to need to get someone who knows SQL in to help.


#7

Here is what I was trying to cook up with my little knowledge in SQL .

    DECLARE 
latest varchar = (SELECT DISTINCT ON (cne_version)
       cne_version
FROM   public.qa_functional_test_packs_results
ORDER  BY cne_version DESC LIMIT 1;)

SELECT id, name, test_pack_name, date, cne_version, sensor_version, additional_comment, test_status, testcase_owner, functional_area, jenkins_link, affecting_bug, regression_run
	FROM public.qa_functional_test_packs_results
where cne_version = latest;

What I am trying to do here is assign the first part of the query result to a local variable and then use that local variable to retrieve the the results of that particular built that I want .
However still have a problem .
org.postgresql.util.PSQLException: ERROR: syntax error at or near "varchar" Position: 136


#8

I think this makes more sense .

SELECT id, name, test_pack_name, date, cne_version, sensor_version, additional_comment, test_status, testcase_owner, functional_area, jenkins_link, affecting_bug, regression_run
	FROM public.qa_functional_test_packs_results
WHERE cne_version = (SELECT DISTINCT ON (cne_version)
       cne_version
FROM   public.qa_functional_test_packs_results
ORDER  BY cne_version DESC LIMIT 1);

Now can I use this SQL query to make all my widgets creating sub questions from this ?