Automation Professionals' Integration Toolkit Module

Another new feature to report. :smile: After I realized I could coerce my iterator functions into executing a common sub-expression once, as shown here:

I decided it was too lame. And would greatly complicate any other use of it() in the expression. And doesn't really track well with the origin of the idea, which was the use of Perspective transforms to ensure a common expression executed just once.

With this update, the expression:

forEach(
	asList(
		split({path.to.some.string}, '/')
	),
	it()[len(it())-1, 0]
)[0]

can now be written:

transform(
	split({path.to.some.string}, '/'),
	value()[len(value())-1, 0]
)

Which is really, really similar to a Perspective expression binding of:

split({path.to.some.string}, '/')

followed by the expression transform:

{value}[len({value})-1, 0]

So, if you have a value expression and an expression transform in Perspective, you can now use that combination elsewhere. Just replace {value} with value(). Specifically, it brings the equivalent of Perspective transforms to:

  • Expression tags (both gateway and Vision client tags),

  • Vision component bindings,

  • Identity Provider attribute mapping,

  • Alarm pipeline expression blocks, and

  • SFC property expressions.

If necessary, you can use objectScript() (or runScript()) to emulate a script transform. If you are following the best practice of have all script transforms be a one-line callout to a project script, the conversion is trivial.

Also, this function can be nested to emulate multiple transforms. If necessary, the depth argument to value() can be used to reach back to a prior stage's result. The nesting of transform() is independent of any use of the iterator functions and does not impact the it() hierarchy depth at all.

For Ignition v8.1+, as usual: v2.0.11.232261523

{Unlike the iteration functions, where expressions involving it() cannot also include connectable functions like now() or tag(), transform() doesn't impose any such conditions on expressions involving value().}

4 Likes