{"action":"created","issue":{"url":"https://api.github.com/repos/grafana/grafana/issues/2214","labels_url":"https://api.github.com/repos/grafana/grafana/issues/2214/labels{/name}","comments_url":"https://api.github.com/repos/grafana/grafana/issues/2214/comments","events_url":"https://api.github.com/repos/grafana/grafana/issues/2214/events","html_url":"https://github.com/grafana/grafana/issues/2214","id":90449513,"number":2214,"title":"Ability to create parent/child relationships between templating variables","user":{"login":"craftytrickster","id":10675565,"avatar_url":"https://avatars.githubusercontent.com/u/10675565?v=3","gravatar_id":"","url":"https://api.github.com/users/craftytrickster","html_url":"https://github.com/craftytrickster","followers_url":"https://api.github.com/users/craftytrickster/followers","following_url":"https://api.github.com/users/craftytrickster/following{/other_user}","gists_url":"https://api.github.com/users/craftytrickster/gists{/gist_id}","starred_url":"https://api.github.com/users/craftytrickster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craftytrickster/subscriptions","organizations_url":"https://api.github.com/users/craftytrickster/orgs","repos_url":"https://api.github.com/users/craftytrickster/repos","events_url":"https://api.github.com/users/craftytrickster/events{/privacy}","received_events_url":"https://api.github.com/users/craftytrickster/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-06-23T17:48:14Z","updated_at":"2015-06-23T20:15:37Z","closed_at":"2015-06-23T17:53:36Z","body":"Imagine the following two variable dropdowns, for *Vehicle Type* and *Vehicle* with the following queries\r\n\r\n1. $VehicleType - `SELECT * FROM vehicle_type`\r\n2. $Vehicle - `SELECT * FROM vehicle WHERE type = $VehicleType`\r\n\r\nVehicle Type  |  | Vehicle\r\n--------- | --------- | ---------\r\nAutomobile  | | **Airbus**\r\nTrain  | | Boeing\r\n**Airplane** | |\r\n \r\n \r\nIn our ideal fantasy world scenario, when the user clicks on Airplane, the Vehicle bucket would update its query results by updating the WHERE clause to search where type = airplane.\r\n \r\nHowever, that would require a directed graph, where variables are explicitly derived from other variables. Grafana would have to know that Vehicle is explicitly derived from Vehicle Type.\r\n \r\nCurrently, that is not how Grafana works. Grafana considers variables as completely isolated from one another. However, we are forcing our variables to be linked by basically the variables’ query results on the values of other variables. That is why when we update a “base” variable like Vehicle Type, the child variables’ options (in this case, Vehicle) do not get updated correctly.\r\n \r\nI think it would be very valuable to be able to explicitly create some kind of parent -> children chain. That way, when a parent variable is updated, all of its children can update their results based on the new selected parent value.\r\n\r\nIf anyone agrees or has any thoughts, please explain."},"comment":{"url":"https://api.github.com/repos/grafana/grafana/issues/comments/114629908","html_url":"https://github.com/grafana/grafana/issues/2214#issuecomment-114629908","issue_url":"https://api.github.com/repos/grafana/grafana/issues/2214","id":114629908,"user":{"login":"craftytrickster","id":10675565,"avatar_url":"https://avatars.githubusercontent.com/u/10675565?v=3","gravatar_id":"","url":"https://api.github.com/users/craftytrickster","html_url":"https://github.com/craftytrickster","followers_url":"https://api.github.com/users/craftytrickster/followers","following_url":"https://api.github.com/users/craftytrickster/following{/other_user}","gists_url":"https://api.github.com/users/craftytrickster/gists{/gist_id}","starred_url":"https://api.github.com/users/craftytrickster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craftytrickster/subscriptions","organizations_url":"https://api.github.com/users/craftytrickster/orgs","repos_url":"https://api.github.com/users/craftytrickster/repos","events_url":"https://api.github.com/users/craftytrickster/events{/privacy}","received_events_url":"https://api.github.com/users/craftytrickster/received_events","type":"User","site_admin":false},"created_at":"2015-06-23T20:15:37Z","updated_at":"2015-06-23T20:15:37Z","body":"I noticed that the sample apps are using the template variable in the series body\r\n`list series /apps.$app.*/`\r\n\r\nWhereas I am using the variable outside of a series body (in a where clause)\r\n`show tag values from \"application.random.statistic\" with key=application where host='$host'`\r\n\r\nIs it possible that the template only works in a series body name? If so, is it by design?\r\n\r\n*Not sure if this is related, but the queries in the samples seem to be using an older templating variable module than what is currently in master.*"}}