Skip to main content
Question

Attribute Editing

  • May 11, 2018
  • 7 replies
  • 37 views

bjudes
Enthusiast
Forum|alt.badge.img+10

Hi

I want to edit a few thousand attributes, basically adding a number of 0's in the middle and end of a string. For example I want 2017_420590 to become 2017_420000_590000.

I think I may have to use the StringFormatter to edit the string use regexpr, I am not experienced using regexpr however.

Thanks for any help in advance.

B

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.

7 replies

david_r
Celebrity
  • 8394 replies
  • May 11, 2018

I don't think you can use regular expressions in the StringFormatter. You can probably use the StringReplacer to achieve the same thing, however.

What's the rule for where and when to intruduce the zeros?


bjudes
Enthusiast
Forum|alt.badge.img+10
  • Author
  • Enthusiast
  • 117 replies
  • May 11, 2018

I don't think you can use regular expressions in the StringFormatter. You can probably use the StringReplacer to achieve the same thing, however.

What's the rule for where and when to intruduce the zeros?

Ah okay, sorry new to this. How would you suggest undertaking the problem?

 

 


david_r
Celebrity
  • 8394 replies
  • May 11, 2018
Ah okay, sorry new to this. How would you suggest undertaking the problem?

 

 

If you can give us the rules for where and when you need to insert the zeros, that would be helpful. A couple of examples of before and after-values would also be nice.

bjudes
Enthusiast
Forum|alt.badge.img+10
  • Author
  • Enthusiast
  • 117 replies
  • May 11, 2018
If you can give us the rules for where and when you need to insert the zeros, that would be helpful. A couple of examples of before and after-values would also be nice.
Okay.

 

I would like the attribute value 2017_420590 to become 2017_420000_590000.

 

 

So the addition of three 0's after every 8th character, next the addition of an _ after the 3 0's. Then finally 3 0's at then end of the string.

 

 

I hope this is what you are asking and makes sense, sorry can be tough to explain.

 

 

Thanks for the help.

 


david_r
Celebrity
  • 8394 replies
  • May 11, 2018

Try the following in a StringReplacer:

Text to replace:   ^(.{8})(.*)
Replacement text:  \1000_\2000

Example:

0684Q00000ArKBDQA3.png


bjudes
Enthusiast
Forum|alt.badge.img+10
  • Author
  • Enthusiast
  • 117 replies
  • May 11, 2018

Try the following in a StringReplacer:

Text to replace:   ^(.{8})(.*)
Replacement text:  \1000_\2000

Example:

0684Q00000ArKBDQA3.png

Perfect, thanks for the excellent and fast help. You are very good. :)

 

 


denizturan1985
Participant
Forum|alt.badge.img
  • Participant
  • 11 replies
  • May 11, 2018

I think you can use AttributeManager text editor with the following expression:

@ReplaceRegEx(@ReplaceRegEx(@Value(_creation_instance),(?<=^.{8}),_),(?<=^.{8})|(?<=0$),000)

0684Q00000ArK3OQAV.jpg

0684Q00000ArK0PQAV.jpg

attribute-editing.fmw

Edit: Including workspace