Transform xml feed (UQL or other methods?)

Hi mates,

I have trouble displaying/transforming data to show in a table on a dashboard.

  • What Grafana version and what operating system are you using?
    latest from Docker, infinity-datasource plugin v1.4.1

  • What are you trying to achieve?
    given following xml structure, I need to get the value of ‘VALUE’ for each ‘entry’ and display the result of this in the columns ‘value1’,‘value2’ and ‘value3’

<?xml version="1.0" encoding="utf-8"?>
<feed>
	<id>1</id>
	<entry>
		<id>1</id>
        <content type="application/xml">
			<m:properties>
				<d:ID>2078</d:ID>
				<d:TASK_GUID></d:TASK_GUID>
				<d:VALUE>1;2;3</d:VALUE>
				<d:OPERATION>0</d:OPERATION>
			</m:properties>
		</content>
	</entry>
    <entry>
		<id>2</id>
        <content type="application/xml">
			<m:properties>
				<d:ID>2079</d:ID>
				<d:TASK_GUID></d:TASK_GUID>
				<d:VALUE>4;5;6</d:VALUE>
				<d:OPERATION>0</d:OPERATION>
			</m:properties>
		</content>
	</entry>
</feed>
  • How are you trying to achieve it?
    I am using the infinity-datasource plugin to retrieve the XML via https. Using the backend parser, I can get the ‘VALUE’ field, but end up with one column ‘VALUE’ on my table that contains the string ‘1;2;3’
    Using UQL I am not able at all to retrieve any information, due to a lack of understanding and missing examples (only ones I found were for json).
    Also, I looked at transformations but was also unable to find a solution for this task.

Is there a way to achieve this result at all?

Thanks!

Could you please post your uql

I cannot even get a simple query to work.
Using

parse-xml
| scope "feed"
| jsonata "entry.content.'m:properties'.'d:VALUE'" 

I get the “1;2;3” value in a “result” column, but cannot do any further stuff with it (most likely due to the lack of knowledge about how to “reuse” this result).

jsonata is the only way I was able to access the field in the xml at all. Using the same path for example with “project” will not return any result at all.

Nevermind, I just did not try hard enough.
This seems to work:

parse-xml
| scope "feed.entry"

|extend "test"=split("content.m:properties.d:VALUE", '__#__')
1 Like