Question

Use multiple String Functions in Attribute Manager?

  • 15 October 2019
  • 7 replies
  • 47 views

Badge +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

Userlevel 1
Badge +21

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)

 

Badge +22

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.
Badge +5

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?

Userlevel 1
Badge +21

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 :-)

Badge +5

Oops apologies!

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

Userlevel 1
Badge +21

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

Badge +5

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