Skip to main content
Question

Attribute order keeping

  • November 18, 2019
  • 3 replies
  • 111 views

Hi all,

 

I have a problem with extracting attributes list ordered previously with Attribute Manager.

I do it via Python Caller and exploding list which contains attributes names. It works OK but the order of these is sorted alphabetically and I need original pre-set by me order.

 def get_att_list(feature):   
    n1 = feature.getAllAttributeNames()
    x=0
    
    for n in n1:    
        print (x,n)
        feature.setAttribute('Attr_name{%d}' % x, n)
        x+=1

 

Generally speaking, I need to get numbers of columns in specific order to use it next in Excel vlookup formula. That is why the order is so important. Maybe there is a better way of doing it? 

3 replies

ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • November 18, 2019

I don't think it's possible to get the attribute names in the same order if they've been re-arranged in the attribute manager

https://knowledge.safe.com/questions/83013/python-getallattributenames-order.html


sigtill
Contributor
Forum|alt.badge.img+24
  • Contributor
  • November 18, 2019

Perhaps you can use the Schemasetter and then reorder the list of schemas afterwards? A workaround, but still.


  • Author
  • November 18, 2019
sigtill wrote:

Perhaps you can use the Schemasetter and then reorder the list of schemas afterwards? A workaround, but still.

Could you tell me how to reorder schema?


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