Skip to main content
Question

Change Columnnames based on first value


Hello i want to change the Columnames based on the first value.

Example:

Column: A

first Value: Dog

newColumname: Animal

3 replies

redgeographics
Celebrity
Forum|alt.badge.img+50

Do you have a list of criteria? I.e. a list of values for column A that would result in it being renamed to Animal.


  • Author
  • January 27, 2022
redgeographics wrote:

Do you have a list of criteria? I.e. a list of values for column A that would result in it being renamed to Animal.

the criteria would be the first value. So check all columns if it has "dog" as the first value. If yes then rename the column to Animal.

 

I have two different Date columns so the dates could be same in both columns but in the first row they have different values so i know the column with the 12.03.2020 is Date_A and the other column with 14.02.1990 is Date_B


redgeographics
Celebrity
Forum|alt.badge.img+50
fluusha wrote:

the criteria would be the first value. So check all columns if it has "dog" as the first value. If yes then rename the column to Animal.

 

I have two different Date columns so the dates could be same in both columns but in the first row they have different values so i know the column with the 12.03.2020 is Date_A and the other column with 14.02.1990 is Date_B

Yes, it's possible.

  1. Build a list of all your features (ListBuilder)
  2. Check if the first list element has attribute value "dog" (TestFilter)
  3. If so, explode the list to get your original features back (ListExploder)
  4. Rename the attribute (AttributeRenamer)

Screenshot 2022-01-27 at 11.34.06I've attached this as a template. Note that if you want to support different animals you should edit the TestFilter.

 


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