Expression equivalent of Python .join()?

Would this qualify as an AI "hallucination?"

It says there isn't an equivalent, then gives an example of an exact equivalent...which as far as I can see, doesn't exist.

It seems like something simple enough that there should be an expression alternative, but if so, Google is of no help.

:see_no_evil:

I don't think there's an expression for this.

The expression language long pre-dates Ignition supporting arrays in the tag system, so expression functions that operate on or return array/list types are still uncommon even now.

The expression equivalent is group_concat(). It was extended at some point to work with arrays/lists in addition to datasets. Use is limited to perspective component properties that are arrays, or fragments of document objects that are arrays.

Unless you have my Integration Toolkit, in which case there are many ways to feed lists to it.

3 Likes

Nice.

So... groupConcat(["hello", "world"], " ") or something like that.

Except the expression language doesn't have array/list literals... so it would have to come from somewhere.

1 Like

Manual says it was added in 8.1.8 (on the groupConcat() page) but if you search the manual for some variant of "concatenation" the only obvious results are for the less-powerful concat expression. Searching join is even worse.

Might be good to have the manual updated somehow to make the secondary function less obscure.

Well, the expression language does not have native syntax for an array constant. With my toolkit:

groupConcat(asList("hello", "world"), " ")
2 Likes

Probably doesn't matter, in reality the array/list value is probably coming from a tag or something. Otherwise you could just type the joined result as a String literal.

Right. Most useful when the first argument is a dynamic expression. I'm usually putting a nested forEach() there.

1 Like