Dataset Expression Row Count

I have a dataset and I would like to check to see if the dataset contains any rows in an expression binding. I know to access the dataset values, you use “Dataset_Expression [x,y]”. Is there a way to check how many rows are in the dataset, similar to data.getRowCount()?

You should be able to check the row count of a dataset in the expression language by simply using the len() function:


Note that this capability of the len() expression is new in 8.1.8, for any users still on an older version.

Do you mean somewhere it broke and was fixed for 8.1.8? Because this functionality goes way back.

I think he’s mixed up adding expanded support for arrays and collections. Looks like the len function has supported DataSets for a long time.


How to get the length of a disticnt column values inside a dataset ?

All the columns will have the same length and this will be the length of the dataset.

Are you asking how to get the maximum string length in a particular dataset column? (If so then this should have been asked as a new thread as it is not related to this one.)


Can I use python's len function to do the same thing within a script?

I'm not sure, I would probably just stick with the default dataset scripting functions in Ignition:

1 Like

Not for any arbitrary dataset. PyDatasets, yes.

Slightly more efficient, and easier on the eyes: