Assign a value from a data set query tag

I'm trying to grab a value from a data set type query tag, but since it makes use of brackets to grab the row and column e.g. [0, 10], I'm getting a tag path is malformed error, I saw that someone else asked a similar question and the only response was to make use of the lookup expression, which won't work for me as I don't have a way of knowing what the data I'm looking for will look like, just that it will be in x row and y column. Any help would be appreciated!

Are you scripting this or using an expression? What does your code look like?

If the address is not out of bounds, you should be getting a value if your script looks like this:

value ="[default]DatasetQueryTag").value.getValueAt(0, 10)
print value

If you are using an expression, then--provided the data point exists--you should you get a value if your expression looks like this:

Obviously, you will need to substitute your own tag path for [default]DatasetQueryTag


Show us how you do it so we can figure out if there's something wrong. It's kinda hard to debug something that we can't see.

Just to clarify Justin's point:

Bracket syntax to access elements of a dataset is supported only in expression bindings or expression tags. Not in tag paths or anywhere else. It cannot be bidirectional. In jython, you use the .getValueAt() method as he shows.

1 Like

I'd been using an expression to do "Text: " + {[default]DatasetQueryTag}[0,10] and attempting to just bind the value of the tag's data directly to the component text (A label) but both were giving me the malformed tag path error

1 Like

I don't have a version 7.9 system setup for testing, and I haven't been able to recreate the error on version 8.1.20

Are you getting your tag path from here?:

What does your tag quality look like in the tag browser?

1 Like

This doesn't seem like a datatype issue, but you could try: "text:" + toString({[default]DatasetQueryTag}[0,10])

1 Like

Yeah, I get the tag path from the 7.9 equivalent of where you're grabbing it from

I think the issue may be with the [RecordDate] brackets part, that seems to be what is causing the error but I'm not sure how else to grab a value from a specific column, since I'm using the format the tag selection in the expression menu uses.

Tag diagnostics seem okay too

Also, toString didn't seem to help either unfortunately

You include the column name, as a string constant, instead of the column index in the latter brackets. Like so:


If there is a chance the dataset is empty, wrap all of that with try(), like so:

try({[provider]path/to/dataset/tag}[0,'RecordDate'], someFallbackValue)

Make sure the fallback value is the same data type you normally get from the column.

See the v7.9 docs: