Book a Demo

Author Topic: Update Pos for Attribute  (Read 4239 times)

jfm

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Update Pos for Attribute
« on: May 02, 2012, 12:27:03 pm »
Hi

In my code, I was trying to update Attribute Pos information. But the thing is, sometime it works but sometime it doesn't.

The code I used is like this:

                            attribute.Pos = pos;
                            attribute.Update();

Can anyone help me to get some understanding on where it goes wrong?

Cheers

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Update Pos for Attribute
« Reply #1 on: May 02, 2012, 12:52:26 pm »
The positions of the other attributes in the same class also matter. So if you have attributes in positions 1,2,3,4,5 and you want to move the last one to the top, you will have to make 5 changes: 1->2, 2->3, 3->4, 4->5 and 5->1.
The Sparx Team
[email protected]

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Update Pos for Attribute
« Reply #2 on: May 02, 2012, 03:22:25 pm »
Also don't forget to refresh your model.
Often the GUI isn't aware yet of the changes made by the API.

Geert

jfm

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Update Pos for Attribute
« Reply #3 on: May 02, 2012, 03:29:38 pm »
Will give that a try. Thanks

jfm

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Update Pos for Attribute
« Reply #4 on: May 02, 2012, 04:23:34 pm »
After I set up the pos for the attributes, the attributes is still displayed alphabetically.

I checked the data in database, all the sequence is set up properly.

I closed the project and reopen it (which suppose to refresh the model on UI), but it is still the same.

Any idea? :(

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Update Pos for Attribute
« Reply #5 on: May 02, 2012, 05:13:13 pm »
Have you turned off the option "sort feature alphabetically"?

Geert