Author Topic: Update a state of an element  (Read 177 times)

tzafrir

  • EA User
  • **
  • Posts: 99
  • Karma: +0/-0
    • View Profile
Update a state of an element
« on: December 07, 2017, 05:13:10 pm »
Hi,

I want to update a state of an element with some value.
I did not find any attribute on the element that holds that can be set.

I tried to use the query:
update t_object set StateFlags = 'SomeStateValue' where object_id = ElementID
and then:
repository.Execute(sql);
element.Update();

This did not update it as well.

Does someone know how can it be updated?

Thanks.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7752
  • Karma: +165/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Update a state of an element
« Reply #1 on: December 07, 2017, 06:13:19 pm »
What do you mean by "State" of an element?

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 8972
  • Karma: +136/-124
  • I'm no guru at all
    • View Profile
Re: Update a state of an element
« Reply #2 on: December 07, 2017, 08:05:14 pm »
Basically your assumption is correct. Did you a) reload the diagram and b) verify with a query that the UPDATE succeeded?

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7752
  • Karma: +165/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Update a state of an element
« Reply #3 on: December 07, 2017, 08:32:26 pm »
I think in fact that your element.update() will undo the changes you did directly to the database.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 8972
  • Karma: +136/-124
  • I'm no guru at all
    • View Profile
Re: Update a state of an element
« Reply #4 on: December 07, 2017, 09:34:48 pm »
Of course. Mixing API and direct database is the best way to shoot yourself in the knee.

q.

tzafrir

  • EA User
  • **
  • Posts: 99
  • Karma: +0/-0
    • View Profile
Re: Update a state of an element
« Reply #5 on: December 10, 2017, 06:00:22 pm »
Thanks,
The issue was with the element.Update() it deleted the value.

You are right,
mixing is problematic but the problem is that there is no element attribute to StateFlags column.