How can I filter the contents in the TABLE panel? - grafana

So is there a way to filter what Grafana shows in a TABLE type of metric?
My issue is that the table returns values which are really really long like a FQDN but for an Azure resource.
It is absolutely unreadable, so I actually want to parse the output with regex or something, to show me only the specific part. At least a line break would suffice.
The row field in the table is something like
azure:///subscriptions/xxxxxxxxxx-4a5b-81ee-04ea1368a7db/resourceGroups/mc_wintermute_wintermute_eastus/providers/Microsoft.Compute/virtualMachineScaleSets/axxxxxxxxvmss/virtualMachines/13
I only need the
subscriptions/xxxxxxxxxx-4a5b-81ee-04ea1368a7db/
It is easier to view it than explain, a
screenshot

Apparently, there is a VALUE MAPPING section in the table parameters, which accepts regular expressions.

Related

MS-Access 2010 Form: field doesn't accept data source with 2 hyphens

I have a form based on a multiple-tables query. As some fields from different tables have the same names, I must add the corresponding table's name. However, there are hyphens in the tables' names as well as in the fields' names (both inherited from foreign Excel tables).
In VBA there is no problem: [Table-1.Field-1] always works well (also in SQL queries). However, when I write this in drafting mode as data source into the form, Access "thinks" this would be wrong and replaces it automatically with [[Table-1].[Field-1]] - with the result that the form then displays the error #Name?. I tried to replace [] by quotes but without any success.
Note that there is no error when only the table or only the field has a hyphen: both MyTable.[Field-1] and [Table-1].Myfield are accepted by the form.
The correct syntax should be:
[Table-1].[Field-1]
Or, using bang notation:
[Table-1]![Field-1]
Meanwhile I found not a true answer, but nevertheless a quite satisfactory workaround by adding following calculated field into the query:
MyWorkAround: [Table-1.Field-1]
Then I can simply refer to [MyWorkAround] in the corresponding form's field to avoid the form's bug. But this isn't really very elegant !
Note that I always use [ … ] around fields, even where not necessary. This practice helps avoiding a lot of errors.

adding up specific mergefield values in word

I have a table in a word document that has three colums and all fields are mailmerge fields from an external IT system.
There are three columns displaying the fields:
Charge Description
Charge Value (£)
Eiligible? (yes/no)
I am trying to create a field that adds up all eligibale charges so that only charge values that show a "yes" in the eligigble field are included. Does anyone know if this is possible? I have tried creating a formula but can't get it to work. Also, I would assume at some point an if statment is required so that it only includes the eligible charge.
Has anyone done anything similar before and if so, would they mind sharing how it was achieved?
Many thanks
You can do some things with expression fields (created in Word with CTRL-F9). This will look like {} and you can insert the expression. eg {{MERGFIELD charge} + {MERGEFIELD charge2}}. Since however you want to check multiple values and then create an expression, its probably easier to use a macro. The macro would contain your logic, then set the fields in the document accordingly.
Here are two external links since I can't reproduce a useful amount the content here because it's a verbose answer to a potentially deep question:
Expression Fields
Merge fields
I hope that helps.

Prioritise which identifier to use

My crystal report pulls data about books, including an identifier (isbn, issn order number etc.), author, and publisher.
The ID field stores multiple ways to identify the book. The report displays any of the identifiers for that record. If one book has two identifiers; issn and order number, the report currently displays one apparently at random.
How can I make it prioritise which type to use based on a preset order? I figured some sort of filter on the field could work, but I haven't figured out how. I can't edit the table, but I can use SQL within the report.
If all the different types of ID are stored in a single field, your best bet is to use a SQL Command inside your report to separate them into multiple virtual fields.
Go to Database Fields / Database Expert, expand the connection you want to use, and pick Add Command. From here you can write a custom SQL statement to grab the information you're currently using, and at the same time separate the ID field into multiple different fields (as far as the report will be concerned, anyway. The table will stay unchanged.)
The trick is to figure out how to write your command to do the separation. We don't know what your data looks like, so you're on your own from here.
Based on the very little information that you have provided and if i was to make a guess.I suggest you make use of the formula field in your report and then use something like this to accomplish your goal.
IF ISNULL{first_priority_field_name} OR {first_priority_field_name} = '' THEN
{second_priority_field_name}
ELSE
{first_priority_field_name}
Use nested IF statement in case there are more than 2 identifier fields.

Must be possible to filter table names in a single database?

As far as I can tell, the search filter in the navigator will only search available database names, not table names.
If you click on a table name and start typing, it appears that a simple search can be performed beginning with the first letter of the tables.
I'm looking for way to be able to search all table names in a selected database. Sometimes there can be a lot of tables to sort through. It seems like a feature that would likely be there and I can't find it.
Found out the answer...
If you type for example *.test_table or the schema name instead of the asterisk it will filter them. The key is that the schema/database must be specified in the search query. The asterisk notation works with the table names as well. For example *.*test* will filter any table in any schema with test anywhere in the table name.
You can use the command
SHOW TABLES like '%%';
To have it always in your tools, you can add it as a snippet to SQL aditions panel on the right.
Then you can always either bring it in your editor and type your search key between %%, or just execute it as it is (It will fetch all the tables of the database) and then just filter using the "filter rows" input of the result set.

mysql retrieve partial column

I am using TinyMCE to allow users to write in what will eventually be submitted to a database.
TinyMCE includes a button which will insert a "pagebreak" (actually just an HTML comment <!--pagebreak-->).
How can I later pull back everything up to the first occurrence of the pagebreak "tag"? There might be a significant bit of data after that tag which I could discard via php later, but it seems like I shouldn't even bring it back. So I can I SELECT just part of a column if I never know how far in to the data the <!--pagebreak--> will be?
EDIT:
The below answer does work, and will get me where I need to go.. I am just curious as to if there is an equally simple way to handle bringing back the whole column if it is short and thus the pagebreak tag doesn't exist. With the below solution, if no pagebreak is found, an empty string is returned.
If not, then I can easily handle it in the code.
Something like this should get you everything up to the <!--:
SELECT SUBSTRING(my_col FROM 1 FOR POSITION('<!--' IN my_col)-1) AS a_chunk
FROM my_table
Reference for string functions.
Edit:
Just putting OMG Ponies' words into SQL:
SELECT CASE WHEN position('<!--' IN my_col) > 0
THEN SUBSTRING(my_col FROM 1 FOR POSITION('<!--' IN my_col)-1)
ELSE my_col END AS a_chunk
FROM my_table
It sounds like you'll also want a check on the length of the text; whether or not there is a page break. You can use CHARACTER_LENGTH() for that.
why not create another column in your mysql table to store integer value of the position where <!--pagebreak--> is. You'll calculate this value in your script and store this value at same time when you insert the html generated by tinymce.
Then in later retrievals use the value in that column to select the substring from 1 up to the value. This should make your query simpler and maybe improve query performance?