Skip to main content
Question

Use multiple String Functions in Attribute Manager?

  • October 15, 2019
  • 7 replies
  • 148 views

umapper1
Contributor
Forum|alt.badge.img+5

Guys!

I was under the impression multiple string functions can be performed on an attribute within the one attribute manager, is this not the case? For example, Pad Left string function followed by the Left string function. Anyone know how to write it? I'm trying to cut down on transformers. My particular scenario below in case there's another way around this.

Sample data format: (regex: \\d?\\d\\.\\d{2}\\\\ )

Pad Left to add any missing leading zeros such as the bottom line.

Left to then strip the bracket off the end.

Results in bottom line changing to 03.98, the rest simply lose the bracket.

7 replies

ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • October 15, 2019

I'd get rid of the bracket using a regex replace then do the padding, can be done in one statement

@PadLeft(@ReplaceRegEx(@Value(Lat seconds),\x{0029},""),5,0)

 


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • October 15, 2019

Wouldn't it just be @Left(@PadLeft(@Value(LatSeconds),2,6, 0),5)

 

 

Though I would probably use @PadLeft(@Trim(@Value(Lat Seconds),")"),5,0) instead.

umapper1
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • October 16, 2019

Thanks gents, both work great! I'm still working out how to combine string functions. The help pages are not very user friendly on this topic. Do you know if this is documented better anywhere?


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • October 16, 2019
umapper1 wrote:

Thanks gents, both work great! I'm still working out how to combine string functions. The help pages are not very user friendly on this topic. Do you know if this is documented better anywhere?

They're just nested functions, the entire first function in bold, becomes the string value of the second function

@PadLeft(@ReplaceRegEx(@Value(Lat seconds),\\x{0029},""),5,0)

Personally, if your data is as per the screenshot, I'd use a single stringreplacer to get rid of the brackets across multiple attributes at once, rather than trying to do it individually with multiple string functions in an AttributeManager

 

p.s. neither of us are gents :-)


umapper1
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • October 17, 2019

Oops apologies!

This is what I'm trying to achieve - thanks for the tip! How would I do that from the one stringreplacer transformer?


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • October 18, 2019
umapper1 wrote:

Oops apologies!

This is what I'm trying to achieve - thanks for the tip! How would I do that from the one stringreplacer transformer?

You can select multiple attributes in the string replacer, then choose to replace the bracket with nothing

You'd still need an attribute manager/string padder for the next step so if your absolute goal is less transformers then it might not be the solution you want. Makes for a much more readable workspace though and quicker than trying to get nested functions correct


umapper1
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • October 18, 2019
ebygomm wrote:

You can select multiple attributes in the string replacer, then choose to replace the bracket with nothing

You'd still need an attribute manager/string padder for the next step so if your absolute goal is less transformers then it might not be the solution you want. Makes for a much more readable workspace though and quicker than trying to get nested functions correct

I agree, much clearer workspace, otherwise I have to remember what was done in the attmanager. Your a star! :)


Reply


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