String operation to take last item inside

Hi my input contain [“Phase1”] or [“Phase1”,“Phase2”] in both the cases it should be [“Phase1”] and [“Phase2”]

Basically it needs to take last item .

How to do in single assign activity .Please help

Hi @tharaninatarajan1901

If it’s in an array you can directly use the variableName.Last
Something like this:


1 Like

If you are getting String Like “Phase1”, “Phase2”
then First Spilt it with Comma like this

Then Get last like this

1 Like

Hi @tharaninatarajan1901

Try this-

yourListVariable = If(yourListVariable.Count > 1, {yourListVariable.Last}, yourListVariable)


1 Like

when the input is a string as above we can use JSON parsing

strJson has the value of: ["Phase1","Phase2"]

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.