Question

merge two attributes

  • 6 March 2015
  • 5 replies
  • 22 views

Hello

I have one attribute table and I would like to merge two attributes into one new attribute in the same table.

 

I though this could work with the attribute creator by merging together two attributes with the help of the arithmetic editor, however this does not work. One attribute is a string, the other one nummerical.

Does anyone has a suggestion?


5 replies

Badge +3
I assume you are using fme 2015.

 

 

The messed expression editor up, though they call it intentionally, it is nonsense. Expressions are processed as usual, but it refuse to let non numerals pass.

 

Normally you could just do @Value(Atrr1)@Value(Atrr2) in a attributecreator no matter what format they were (as long as you did't let it Evaluate it).

 

 

I posted a ticket on this, i hope more people will do same.

 

 

So in your case you can just use the concatenator for the attribute merging.

 

If its conditional you can acces concatenation trough the  text editor in the output section of the conditionalvalue section.,

Thank you, it worked!

Just out of curiosity, what is the Evaluator for in AttributeCreator?

Badge +3
@Evaluate(String) causes a evaluation of the string.

 

 

If string is not a expression, for instance a  concatenation of attributes like yours, it will cause an error.

 

 

Attributecreator automaitcally inserts one, wich is a bit of a nuiscance.

 

 

 

It is needed when u have nested operators in the expression (i mostly use TCL functions)

 

Like this one (it has 6x an evaluation call):

 

 

  
 @Evaluate(@Evaluate(@FindString(@Value(tst),R,0,T))?"@PadRight(@TrimRight(@Value(tst),[R,L])+18,@StringLength(@TrimRight(@Value(tst),[R,L])+18)+1,L)":"@PadRight(@TrimRight(@Value(tst),[R,L])+18,@StringLength(@TrimRight(@Value(tst),[R,L])+18)+1,R)")
 

 

this one is from a forumquestion a week or so ago.
You should use a StringConcatenator(transformer) if you want to merge two attributes.
Badge +3
@Value(Atrr1)@Value(Atrr2) 

 

this is a stringconcatenation.

 

 

But if you want ot, you can use the Transformer of course.

 

Though there are plenty reasons to use a concatentation in a creator/tester/testfilter etc.etc.

 

 

Reply