I have expression Tag ,value type String
A/B/C/D/N/M
I would like to use direct expression to return the string always the last two parts after /
means, result for above example A/B/C/D
other example
A/B/C/D/E/F/G
return should be A/B/C/D/E
With my Integration Toolkit module:
transform(
split({[.]SourceStringTag}, '/'), // delivers a dataset, one part per row
groupConcat( // Assembles from rows like python .join()
where(
value(), // The split result
idx() < len(value()) - 2 // True for all but the last two rows
),
0, // Pick from column zero (the only one)
'/' // Rejoin with the same character
)
)
Something with a script if you don't have my toolkit.
1 Like
Below example is based on an expression tag in the same folder as a memory tag (FullTag
) with a value of the full string.
To return everything before last "/":
left({[.]FullTag}, lastIndexOf({[.]FullTag}, "/"))
So, to return everything before second-to-last "/":
left({[.]FullTag}, lastIndexOf(
left({[.]FullTag}, lastIndexOf({[.]FullTag}, "/"))
, "/"))