Searching a dataset through expression

Is it possible to search inside a dataset using the expression language?

We set a client tag to create a dataset through a SQL query, then create a custom property to the client tag. The dataset can have anywhere from 1 to 4 rows depending on a selection we make. So we don’t always know how many rows it will have and doing a {Root container.dataset}[row, column] isn’t always going to be the same. I almost though the lookup function would work, but seems it only works for table data…, unless we set the dataset to a Table. Is there any other ways to do this?

The lookup expression should work on any value of type DataSet:
image

Here’s the lookup expression in _testDatsetLookup tag:

lookup({[.]_testDataset}, 1, '.', 'id', 'value')
2 Likes

If you want the entire selected row, or need to compare more than one column to find the desired row, you can use the view() expression function from my Simulation Aids module (free). You’d use it like so:

view("Select * Where some_column==args[0] and some_other_column==args[1]",
  {Root Container.SourceDatasetProp},
  {Root Container.MatchSome},
  {Root Container.MatchSomeOther})
2 Likes

Thank you to both for the solutions.

@witman’s idea was what I was trying and looking for, but didn’t get it to work before I asked this question, but I did get it to work now. Must have been syntax or something.

@pturmel - Thanks for the great contribution, will definitely be using more datasets in the future and your module looks great.