Way to get a whole row of a dataset via an expression?

I know you can get a row/column value from a dataset by doing something like try({Root Container.Data}[row, 'columnName], -1). Is there a way to get the full row from a dataset into another dataset property?

I inherited a screen with 160 templates, and each feeds a full copy of a root container custom dataset into its template, where that dataset is then parsed… its slow as you might imagine. I was wondering if there was a way I could only give the template the appropriate row to parse out?

Maybe via a script in a custom method, then use runScript in the expression.

1 Like

Good point, I was more specifically wondering if there was a pure built in way but good to remember I always have that option.

This isn’t possible directly through expressions, but I do have to wonder if it’s actually the slow part of the equation; it’s (unfortunately) hard to benchmark Vision but you might be surprised where the actual slowdowns are.

2 Likes

It could be a number of issues tbh, this project is shall we say, not optimized.

The whole template needs to be duplicated and changed up a bit due to some database changes for some items, so I don’t think I need answer anymore.

I don’t know if I should delete the question, or leave it up in case someone else searches for the answer to this.

Nah, leave it up. Never hurts.

I was actually hoping to add this functionality when I reworked expressions to be ‘aware’ of Java arrays and lists, but unfortunately the dataset ‘subscript’ already assumes you mean ‘the first row’ if you just ask for a specific column {dataset}["myColumn"], so it’s impossible to do and maintain backwards compatibility.

1 Like

Would a lookup expression be better to use here?

How? I thought lookup is related to one column and comparing a value.

view("Select * Where _r = args[0]", {Root Container.path.to.dataset}, {Root Container.path.to.rowIndex})
2 Likes

Generally speaking, your dataset should have a unique-value column. The lookup value becomes a parameter in the template. It's no different than {dataset}[row, col], except you can lookup the row.

Ok, you weren’t suggesting to use it to get an entire row, but to use in the template itself. I misunderstood.

1 Like