Question

How to set a new attribute value which is also an attribute?

  • 13 April 2021
  • 4 replies
  • 33 views

I have a set of data which contains an attribute name (header/title) which I have to use an an attribute value for a new attribute. At the moment, I am using attribute creator to create a new attribute and then attribute manager to add this to existing data. However I am unable to set the new attribute value as one of the attribute name of existing data (which I read in using reader transformer). Any help will be highly appreciated.


4 replies

Userlevel 6
Badge +31

If I understand correctly you want to create an attribute with an attributename based on an attributevalue, and the value based on another attributevalue? You can simply do this in the AttributeCreator:

2021-04-13_13h27_192021-04-13_13h29_46Now you can see the result in the Data Inspector, but in the Feature Information window only, as it is an unexposed attribute.

2021-04-13_13h34_33To see the attribute in the table / workspace, you need to expose it as well. You can do this using an AttributeExposer.

 

If I understand correctly you want to create an attribute with an attributename based on an attributevalue, and the value based on another attributevalue? You can simply do this in the AttributeCreator:

2021-04-13_13h27_192021-04-13_13h29_46Now you can see the result in the Data Inspector, but in the Feature Information window only, as it is an unexposed attribute.

2021-04-13_13h34_33To see the attribute in the table / workspace, you need to expose it as well. You can do this using an AttributeExposer.

 

I think I cannot do that. At the moment I have an excel file which have 54 columns with about 100 rows. Let's say the header/attributes are 'Serial Number: No', 'Revenue: R', 'Location:L' and 'Time:T'. I have to add another column with the title 'Type' and all the rows in that column must be 'Revenue'. So I create a new attribute by using attributecreator, put the name of the new attribute as 'Type' but I am unsure how can I set the value of my new attribute as 'Revenue'. I know I can use regex but am unsure how?

Userlevel 6
Badge +31

I think I cannot do that. At the moment I have an excel file which have 54 columns with about 100 rows. Let's say the header/attributes are 'Serial Number: No', 'Revenue: R', 'Location:L' and 'Time:T'. I have to add another column with the title 'Type' and all the rows in that column must be 'Revenue'. So I create a new attribute by using attributecreator, put the name of the new attribute as 'Type' but I am unsure how can I set the value of my new attribute as 'Revenue'. I know I can use regex but am unsure how?

I'm not sure if I understand what you want. Please create a sample as you need it in excel and post a printscreen so I can see what you try to do.

I think I cannot do that. At the moment I have an excel file which have 54 columns with about 100 rows. Let's say the header/attributes are 'Serial Number: No', 'Revenue: R', 'Location:L' and 'Time:T'. I have to add another column with the title 'Type' and all the rows in that column must be 'Revenue'. So I create a new attribute by using attributecreator, put the name of the new attribute as 'Type' but I am unsure how can I set the value of my new attribute as 'Revenue'. I know I can use regex but am unsure how?

I read this data using reader and have 3 attributes (US: Age, US: Income, US: Deaths). My aim is to add another attribute (4th column) with the title "Country" and which has all the values as "US" and change the existing attribute names to (Age, Income and Deaths).Screen Shot 2021-04-13 at 9.59.47 pm 

My End goal is this:

 

Screen Shot 2021-04-13 at 10.02.48 pmThe other data however needs to remain the same. I was using random generator so thats why the numbers changed. 

Thank you in advance!

Reply