Counting List Size after Cell Splitter

I need to calculate the average time spent per service request by counting the number of logged call numbers stored in a column as a comma-delimited string.

Example:
[NAME] [CALL REF NR] [NR OF HOURS]
Joe Soap “a12, a23, d45, x22” 10

I need a way to calculate that Joe Soap has 4 reference numbers - i.e. so that 10 hours / 4 calls = 2.5hr per call

After using Cell Splitter (with the list object setting) it splits the strings using a “,” delimiter. I later use this for other operations. I cannot find a way to extract the list or array size from the node in a standard way. Does any one have a perspective on how I can obtain the list size - I would then run a math function or similar to calculate the average. I’m trying to avoid custom code if possible.

Any advice is appreciated.

Hi @CobusSmit,
this looks like a great way to test out the new Column Expressions node, just create an expression with the following code, (before the cell splitter):

column("NR OF HOURS") / column("CALL REF NR").split(",").length;

That will return the average number time spent on the call, no need for a math node.

best,
Gabriel

3 Likes

Thank you so much. The Column Expression node is amazing. Like magic.

Much appreciated.

Side question and note: So .split(",").length works perfectly, but it’s not listed in the function specficiation in the configuration dialog - is this maybe because the function list is still to be updated?

That’s due to the fact that the the Column Expressions Node provides predefined functions that can be easily used by everybody, while ‘.split(",")’ and ‘.length’ are called on so called objects (String and array).
We are currently working on collection support, i.e. using collections and retrieving collections in expressions.
And thus introducing more functions, such as split and length, that can be easily used as the already contained functions.

2 Likes

I made use of the fact that the Column Expressions node is based on javascript and used functions which are provided by the language. As @moritz.heine pointed out, we are still working on proper collections support.
best,
Gabriel

1 Like