Break long string into rows

I need to break apart a long text string into their own rows by lets say 10. I don’t always know the length, but the max should be 10 for each Note row.

Example:

Account | Note
123456 | abcdefghijklmnopqrstuvwxyz

Output Needed:

Account | Note
123456 | abcdefghij
123456 | klmnopqrst
123456 | uvwxyz

If you know that the Note field is guaranteed to be shorter than Nx10 characters, you can use the “Split fixed width text” action to split Note into N columns and then unpivot them.

Here is an example:
split-fixed-width.morph (3.3 KB)

image

The note field unfortunately can go to 255. I think I found a solution though. Thanks anyway.

image

1 Like

Challenge accepted! No iterations, just 4 actions, any Note length.

split-fixed-width.morph (3.3 KB)
image

2 Likes

Nicely done. Exactly what I was doing, just without an iteration.

Yes, your use of “Repeat rows” gave me the idea.

Here is another one with regex)

split-regex.morph (3.2 KB)

3 Likes

Neat! In case someone is curious, the regex is quite simple:

.{1,10}
3 Likes

You might need another step to remove empty rows if they divide by 10 exactly. I made the second account 40 to show. The regex might be the way to go. Thank you both!

image

1 Like

I made a rounding mistake. It should be:

div(len([Note])-1,10)+1

Instead of

div(len([Note]),10)+1

The count always shows the number of rows required to fit the text string. Filtering is not required, because the count can always be calculated correctly beforehand.

The updated version:
split-fixed-width.morph (3.4 KB)

1 Like