Dataset Row and Column count

Hi everyone, I was wondering if there is a way to check on the number of rows of a dataset using Expression language. I know you can do it with scripting. I check order numbers I get from PLC with a 3 tables to come up with the actual part number and sometimes one order number has two part numbers ( left and right). I want to use this in my if statement so basically if there is only one row then give me {Dataset}[0,0] if more than one row then give me {Dataset}[0,0] +{Dataset}[1,0].
Right now my solution to this issue is to use another Query tag to get the number of rows of my dataset and then use that tag in my expression code. figured to check if there is a better way?
Thank you.

My swiss army knife to the rescue! Use this expression after installing Simulation Aids:objectScript("''.join([args[0].getValueAt(r, 0) for r in range(args[0].rowCount)])", {Root Container.myCustomDatasetProp})

You can use

len({MyDataSetTag})

Or

Are you concatenating 2 strings?

groupConcat({MyDataSet},0,",")

Or adding?

sum({MyDataSetInt},0)
3 Likes

jpark and pturmel Thank you both for your replies but jpark’s solution was exactly what I was looking for since I was looking for a simple Expression code to get it done. Thanks again both of you. :thumb_right: