Question

Set Column Order

  • 28 January 2014
  • 2 replies
  • 0 views

Is there a way to change the column /  field order by a attribute value?

2 replies

Badge +3
I think you would have to make a script, python or tcl, to generate a outputschema based on the attribute u want to order.

 

That would involve a workspacerunner probably.
Userlevel 2
Badge +17
Hi,

 

 

Do you perhaps need to swap multiple attribute values by ascending order like this?

 

Input attribute name : value

 

FieldA : 3

 

FieldB : 1

 

FieldC : 2

 

Output attribute name : value

 

FieldA : 1

 

FieldB : 2

 

FieldC : 3

 

 

If so, one possible way is to use a list attribute.

 

1) Convert target attributes to a list attribute (AttributeRenamer).

 

FieldA --> _list{0}

 

FieldB --> _list{1}

 

FieldC --> _list{2}

 

 

2) Sort the list elements (ListSorter).

 

 

3) Recover the original attribute names (AttributeRenamer)

 

_list{0} --> FieldA

 

_list{1} --> FieldB

 

_list{2} --> FieldC

 

 

Takashi

Reply