Expression function binding to limit dataset without doing a script

I have a dataset like image below,
I'am look a expression function binding or a simple solution to limite row data on the a table
image

I would like to get 20 first rows of table.

My Integration Toolkit module's where() expression function can do this easily:

where({Root Container.path.to.source.dataset}, idx()<20)
2 Likes

If you can't use Phil's toolkit, the simplest way to do this would probably be:

new_ds = system.dataset.toDataSet(
	list(ds.columnNames),
	system.dataset.toPyDataSet(ds)[:20]
)

Probably not the most performant, but it doesn't get much simpler than this.

Note that if you just want to display it in a table, you can skip the conversion back to a dataset.

edit:
actually, this is even simpler, and more performant:

new_ds = system.dataset.deleteRows(ds, range(20, ds.rowCount))
5 Likes

Merci @pascal.fragnoud