Showing different elements of a DATASET data type on a label

Hello everyone,

I created a query tag with a dataset data type. The result of this tag is one row by 17 columns.
Based on the video linked below I am assuming that I can show this dataset data type only on components that have a property data type of dataset like tables.
https://inductiveuniversity.com/videos/array-and-dataset-tags/7.9

But what if I want to show each element separately? As I am not using a table in my program
I want to be able to show each of these numbers/or sometimes texts on a label or some display component.

image

Instead of doing the procedure above, I decided to bind the text property of each label to an SQL Query and it worked perfectly fine! So I assume using the data of one query tag for different labels is not a good choice. :slight_smile:

If you are using perspective you could do something like the following:

Add a markdown component to you view, set the escapeHtml property to false, then bind the source property to your dataset tag with the following script transform:

	headers = system.dataset.getColumnHeaders(value)
	html = '<html>'
	for header in headers:
		html += header + ': ' + str(value.getValueAt(0, header)) + '<br>'
		
	return html

This will display your 1x17 dataset in the following format:
header1: value1
header2: value2
header3: value 3

1 Like

Thank you very much for your response! Appreciate your time.
I will try that.

Another option would be to store your dataset in a tag and create a label for each value in your dataset, then bind the text property of each label to an expression that a gets the desired value from the dataset tag:

"data label: " + toStr({path of your dataset tag}[0, "your column name here"])

Having the single query tag would prevent you from having to execute 17 queries against your database to update your data.

This would be more flexible than my original mardown suggestion because you could arrange the labels however you want on your screen, and it works in vision as well.

1 Like

Thank you!