Skip to main content
Solved

assign new attribute value


Hi,

 

I want to assign value to attribute A based on the value of attribute B.

 

e.g.

 

attribute_A     attribute_B

 

   1                   type1

 

   1                   type1

 

   3                   type3

 

...9                   type9

 

  ....

 

 

I know the attributeValueAssigner can do the job. But I have to type all the unique source value (here the values in attribute B). Is there a way to query all the unique values of attribute B. And then assign related value to attribute A?

Best answer by takashi

I got it. I would use the DuplicateRemover to get unique values of the attribute_B, and write them into an external table. e.g. csv.

 

Edit the table manually to define corresponding values (A) for each value (B); and then, merge the A values read from the table to the source data with FeatureMerger or Joiner, using B value as the join key.
View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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.

3 replies

takashi
Supporter
  • June 4, 2015
Hi,

 

 

If the requirement is to extract the digits part from the attribute_B, the StringSearcher with this setting might help you.

 

Search In: attribute_B

 

Regular Expression: \\d+

 

Matched Result Attribute: attribute_A

 

 

The regular expression "\\d+" matches with one or more consecutive digits, and the transformer assigns the matched part to the attribute specified in the "Matched Result Attribute" parameter.

 

 

Takashi

  • Author
  • June 4, 2015

 

Thanks. But that's not what I need. My example just gives the wrong impression.Sorry for that.

 

I need for instance, type1 -> 133,  type2 -> 343, etc. Of course, after I can get the unique values from attribute B, I need to manually assign new values to those unique values. Then apply them to the attribute A of all the features.

takashi
Supporter
  • Best Answer
  • June 4, 2015
I got it. I would use the DuplicateRemover to get unique values of the attribute_B, and write them into an external table. e.g. csv.

 

Edit the table manually to define corresponding values (A) for each value (B); and then, merge the A values read from the table to the source data with FeatureMerger or Joiner, using B value as the join key.

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