Skip to main content
Question

SplitAttribute every nth character

  • July 5, 2018
  • 4 replies
  • 241 views

joshuadamron
Contributor
Forum|alt.badge.img+8

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!

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

jdh
Contributor
Forum|alt.badge.img+37
  • Contributor
  • 2002 replies
  • July 5, 2018

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

 


david_r
Celebrity
  • 8394 replies
  • 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
Celebrity
  • 7843 replies
  • 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
Celebrity
  • 7843 replies
  • 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

Oops, I've fallen behind!

 

255? 254?