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:
image

Thanks

1 Like

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

StringArray=Split(“YourString,”,")
Then Get last like this
StringArray.Last

1 Like

Hi @tharaninatarajan1901

Try this-

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

Thanks!!

1 Like

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

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

1 Like

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