Skip to main content
Question

SplitAttribute every nth character


joshuadamron
Contributor
Forum|alt.badge.img+7

Howdy,

I need to split a memo field (WrkDesc) that is over 2500 characters into several fields that are 255 characters or less (WrkDesc1, WrkDesc2, WrkDesc3, etc). Right now I laid out a bunch of SubstringExtractors which each grab a different section of the text (0-254, 255-508, 509-762, etc) and it works fine. However it seems like I should be able to do this within a single transformer like AttributeSplitter.

In the AttributeSplitter help it says "Alternatively, instead of using a delimiter character you can provide a string in the format #s#s#s, where each number is the length of the substring you wish to extract."

The way I interpreted that statement, for Parameter> Delimiter or Format String I inserted this: 254s508s762s1016s1270s1524s1778s2032s2286s2540s2794s and generated a list named _listWkDesc

However the output is a single list element _listWkDesc{0} with a copy of the memo fields entire original text. I had expected to see a bunch of list elements each with 254 character's of consecutive text.

Can someone point out the obvious and show me what I'm missing?

Thank you!

4 replies

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • July 5, 2018

If you want to split it into 255 character strings, the expression should be 255s255s255s.

 


david_r
Evangelist
  • July 6, 2018

You can also use the StringSearcher with the following regex:

(.{1,255})

0684Q00000ArLvLQAV.png

You will then get a list "_parts{}" containing each block of maximum 255 characters.


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • July 6, 2018

Alternatively, you can also use the StringSearcher with this regular expression. Split texts will be stored in the Subexpression Matched List.

(.{1,254})

 

0684Q00000ArLvQQAV.png


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • July 6, 2018
takashi wrote:

Alternatively, you can also use the StringSearcher with this regular expression. Split texts will be stored in the Subexpression Matched List.

(.{1,254})

 

0684Q00000ArLvQQAV.png

Oops, I've fallen behind!

 

255? 254?

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings