Hello,
I’m with some problems with the GRAPH, when i use a more complex query.
I have the latest version of GRAFANA ( * v7.0.1 (ef5b586d7d)), and i’m using SQL dataServer.
the issue happens, when come together, with TAGs to read data from two tables of my SQL database, and select the Lines view option, however, if i select the points view option, everything its ok.
I believe that this is an issue of grafana, because the data its ok, but the GRAF PANEL, seems that can’t be able to handle this.
Any ideia how to put this query properly running? ( without doing it one by one without tags)
This is my query:
*select*
*CONCAT(SUBSTRING(RIGHT(tagname,len(tagname)-(CHARINDEX('C[',tagname))-1),0, (CHARINDEX('].',tagname)-CHARINDEX('C[',tagname))-1),',',case when RIGHT(tagname,2)='TT' then 'TT Bomba' else RIGHT(tagname,2) end) as metric*
*,val as 'value',$__timeEpoch(dateAndTime)*
*from db_ftviewse..pumpsPROCtagtable left join db_ftviewse..pumpsPROCfloattable on pumpsPROCtagtable.tagindex=pumpsPROCfloattable.tagindex*
*Where *
*$__timeFilter(DateAndTime) and*
*case when RIGHT(tagname,2)='TT' then 'TT Bomba' else RIGHT(tagname,2) end*
*IN ($Instrumento)*
*and*
*SUBSTRING(SUBSTRING(RIGHT(tagname,len(tagname)-(CHARINDEX('C[',tagname))-1),0, (CHARINDEX('].',tagname)-CHARINDEX('C[',tagname))-1),3, (CHARINDEX('].',tagname)-CHARINDEX('C[',tagname))-3)*
*IN($Tanque)*
*and pumpsPROCtagtable.TagIndex not in(44)*
*union all*
*select*
*CONCAT(SUBSTRING(RIGHT(tagname,len(tagname)-(CHARINDEX('k[',tagname))-1),0, (CHARINDEX('].',tagname)-CHARINDEX('k[',tagname))-1),',',case when RIGHT(tagname, len(tagname)-(CHARINDEX('].',tagname))-1)='TT' then 'TT Deposito' else RIGHT(tagname, len(tagname)-(CHARINDEX('].',tagname))-1 ) end ) as metric*
*--CONCAT(SUBSTRING(RIGHT(tagname,len(tagname)-(CHARINDEX('k[',tagname))-1),0, (CHARINDEX('].',tagname)-CHARINDEX('k[',tagname))-1),',', case when RIGHT(tagname,2)='TT' then 'TT Deposito' else RIGHT(tagname,2) end) as metric*
*,val as 'value',$__timeEpoch(dateAndTime)*
*from db_ftviewse..tksPROCtagtable left join db_ftviewse..tksPROCfloattable on tksPROCtagtable.tagindex=tksPROCfloattable.tagindex*
*Where *
*$__timeFilter(DateAndTime) and *
*case when RIGHT(tagname, len(tagname)-(CHARINDEX('].',tagname))-1 )='TT' then 'TT Deposito' else RIGHT(tagname, len(tagname)-(CHARINDEX('].',tagname))-1) end*
*IN ($Instrumento)*
*and*
*SUBSTRING(SUBSTRING(RIGHT(tagname,len(tagname)-(CHARINDEX('k[',tagname))-1),0, (CHARINDEX('].',tagname)-CHARINDEX('k[',tagname))-1),3, (CHARINDEX('].',tagname)-CHARINDEX('k[',tagname))-3) IN ($Tanque)*
*and tksPROCtagtable.TagIndex not in(166)*
Thanks