How to define a tags / value query in Grafana 7.4? - grafana

I am having some trouble understanding the concept of Value groups/tags in Grafana 7.4.x with MySQL as a data source.
My main query gets the Countries
SELECT
NAME as __text,
id AS __value
from
countries
The tags query gets the Continents
SELECT
NAME as __text,
id AS __value
from
continents
That works so far, tags are shown in the list, but nothing happens once I click on them.
My tags query:
continents.$tag.*
The tags query seems to be the problem. Any help is greatly appreciated.

3 queries are involved:
The first one is under "Query Options" -> "Query": This one should list all the values (all the countries in your case).
The second query is the "Tags query" under "Value groups/tags": This query should list all the Tags you want (continents).
The third query is "Tag values query": This is where the magic happens, this query should return all the different values matching the selected tags, so, you must add a WHERE clause somewhere that Grafana will use to create a query to get the correct values, ...WHERE continent = '$tag'. <- $tag will automatically be replaced by a list of tags the user has chosen.
Be aware that the official documentation provides examples for InfluxDB datasource, since you are using MySQL, you must use SQL queries everywhere, so continents.$tag.* is invalid.

Related

Filtering a datasource using multi select wild character

Does anyone know if there is a wildcard character in AppMaker that can be used for all possible values for a field in a query?
I currently have a datasource that is being filtered based on the status using a multi-select widget. What I would like to accomplish is when all values have been de-selected I want to load all the records of that datasource without clearing the entire query in case other filters have been applied. I have it working in-a-sense that I have to explicitly construct my query as such:
widget.datasource.query.filters.Status._in = ['Status Value 1','Status Value 2','Status Value 3']
My current solution is loading the correct data when a value is selected and it correctly shows the union of the query as the values are modified. However, it selects all of the values in my multi-select; which I know is how it is supposed to work.
I tried using widget.datasource.query.filters.Status._contains = ''; and changing the assignment value to no avail. I even tried the opposite approach using _notContains
The intended outcome is to have a filtering dashboard appear much like any website where when no filtering is selected all records are displayed. I was hoping to find a wildcard character that would load all of the records. Just trying to find a way to mimic other website filters with all records when none are selected.
Thanks for the time!
So the easiest solution here is to set up your Multiselect as follows:
Options binding:
#models.YourModel.fields.Status.possibleValues
or if you don't have the possible Status values in your model then set your options binding to:
['Status Value 1','Status Value 2','Status Value 3']
Values binding:
#datasource.query.filters.Status._in
Now anytime you select any choices in the multiselect, the query will only include records that include the selected choices. And if you deselect all choices the query will ignore that filter or treat it as an empty array of values, therefore returning all records unless you applied other filters.

Distinguish tags from fields in InfluxDB "SELECT *" results

Assume you're given an InfluxDB measurement you haven't seen before and you run,
SELECT * FROM measurement
How can you tell which of the keys returned are tags, and which are fields? The InfluxDB shell sorts the keys alphabetically, so unlike the Line Protocol, fields don't come before tags.
You can see which is which with
show field keys from <measurement>; show tag keys from <measurement>
There seems to be no indication of which SELECT result columns are fields and which are tags, but you can select all fields separately from tags with
SELECT *::field FROM <measurement>

Microsoft Access - Creating a form which looks up data between 2 dates

For my College assignment, I have to create a database in Access, I have done 99% of my database, apart from this section which I'm stuck on.
In my DB, I have a tickets table, which contains records on order information and a field containing a date. For my assignment, I have to create a Form which reads from a Query.
For example, in my Form i have already created i have 2 Combo boxes with the dates already pulled from the Query. I need to be able to drop down one of the boxes and input 1 date, and then drop down the other box and select a different date, press a button and it generate me a Report.
The part I am asking for help on is the expression which is used to look up the data inside the Query. I tried using this expression, which Access said was too complicated.
[Forms]![frmOrdersBetweenTwoDates]![Combo33] And [Forms]![frmOrdersBetweenTwoDates]![Combo36]
My full SQL query is:
SELECT tblTickets.CustomerID, tblCustomers.FullName, tblCustomers.AddressLine1, tblTickets.OrderNumber, tblTickets.OrderDate
FROM tblCustomers INNER JOIN tblTickets ON tblCustomers.[CustomerID] = tblTickets.[CustomerID]
WHERE ((("WHERE [OrderDate]") Between [Forms]![frmOrdersBetweenTwoDates]![Combo52] And [Forms]![frmOrdersBetweenTwoDates]![Combo54]));
My expression/query now returns the report, but there is no data inside the report. How could i fix this?
Cheers.
Should post the complete query statement. Expect the filter clause should be like:
WHERE [date fieldname] BETWEEN [Forms]![frmOrdersBetweenTwoDates]![Combo33] AND [Forms]![frmOrdersBetweenTwoDates]![Combo36]
However, I don't use dynamic parameterized queries. I prefer to use the WHERE argument of OpenReport (same for OpenForm), in VBA:
DoCmd.OpenReport "report name", , , "[date fieldname] BETWEEN #" & Me.Combo33 & "# AND #" & Me.Combo36 & "#"

Sharepoint Online Rest Query with $expand generating 400 bad request

I have 2 sharepoint lists setup to represent different groups(circles) and the users that are apart of those groups(circles).
List: Circles Columns: Circle(single line of text)
List: UserCircles Columns: UserName(person lookup), UserCirlce(lookup to Circle list)
In the setup, all of the columns are their own columns (I have not renamed the title column to Circle or anything like that). I have not changed the display names of the lists.
When I try to run an REST GET against the UserCircles list and retrieve the projected values from the Circles list as below:
/_api/web/lists/getbytitle('UserCircles')/items?$select=Circles/Circle&$expand=Circles
I get a HTTP 400 Error and the message:
The field or property 'Circles' does not exist
I can successfully run a query against the UserName field (I assume that's the referenced field), by running the below query:
/_api/web/lists/getbytitle('UserCircles')/items?$select=Author/Title&$expand=Author
I am not sure why the query cannot find the list specified. I have verified all of the list names. Any guidance would be appreciated.
There is a typo in your example, since the name of lookup field is UserCirlce, the query should be like this:
/_api/web/lists/getbytitle('UserCircles')/items?$select=UserCirlce/Circle&$expand=UserCirlce
Note: the name of lookup field have to be specified in $expand query
option
The list of examples for syntax's of $expand query option:
/_api/web/lists/getbytitle('<listtitle>')/items?$select=<lookupfieldname>/<projectedfieldname>&$expand=<lookupfieldname>
/_api/web/lists/getbytitle('<listtitle>')/items?$select=<lookupfieldname>/<projectedfieldname1>,<lookupfieldname>/<projectedfieldname2>&$expand=<lookupfieldname>

Filemaker Value List Troubles - Missing Items

I am relatively new to Filemaker programming, but I have come across what I thought was a bug, which I have been tearing my hair out trying to squash, only to find it is more a "feature" than a bug. I have a field set as the key for lookups in a ms sql database which I have created a relationship with. I have it set as a drop down, and it is showing 2 fields (last name and first name). Unfortunately, it only shows 1 person per last name in the sorted list (example, there are 5 people with the last name "Bennett" but only 1 shows). After driving myself nuts trying to find the error, I found the following in the filemaker troubleshooting section:
"
If the value list is defined to display information from two fields, items will not be duplicated for the field on which the value list is sorted. For example, if the value list displays information from the Company field and the Name field, and if the values are sorted by the Company field, only one person from each company will appear in the value list."
As I read it, I can't do what I need to do with a value list (display EVERY last name from the sql file) so what other options do I have? I have experimented with creating a portal which DOES show a list of ALL the last names and first names, but I don't know/understand enough to know what logic/functionality I need so if I click one of the people in the portal list it will do the same thing as if I clicked it in a dropdown value list, which is to then do the lookups and populate the rest of the fields in this database from the information in the record in the sql database. Any and all help would be greatly appreciated, and I appreciate any help any of you can offer. Thank you!
There might be some things that cause this;
You cannot create a link based on a calculation that needs to be calculated each time (Filemaker does not know what to do with this, logical in a way)
Based on what you do I would personally link the two tables based on an lets say company ID instead of a name, as a one to many join. This will definitely eliminate the 'feature' filemaker has of showing unique names only in the joined table. On database level I would join on ID, on Value list I would select the ID as first field and the (calculated) name as second field, than showing only the second field (option in the value list definition popup) for your selection list.
Hope this helps.