Book a Demo

Author Topic: EA.Element.Runstate setter does not work  (Read 4206 times)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
EA.Element.Runstate setter does not work
« on: August 29, 2018, 11:52:31 pm »
The setter for EA.Element.Runstate doesn't seem to work.
No Code below results in
"Runstate = " where I would expect "Runstate = 123"

Code: [Select]
option explicit

!INC Local Scripts.EAConstants-VBScript

sub main
dim selectedElement as EA.Element
set selectedElement = Repository.GetTreeSelectedObject()
selectedElement.Runstate = "123"
Session.Output "Runstate = " &selectedElement.Runstate
end sub

main

Anyone know why? The manual simply says it's a string and it is read/write, so I would expect this code to work.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: EA.Element.Runstate setter does not work
« Reply #1 on: August 30, 2018, 06:07:27 am »
Maybe you just forgot the Update?

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA.Element.Runstate setter does not work
« Reply #2 on: August 30, 2018, 02:59:42 pm »
Maybe you just forgot the Update?

q.

I tried it with update as well to make sure, but that doesn't (and shouldn't) make a difference.
I don't need to save to the database for the field to contain the value "123"
If I do the same with another field such as name, Header1, ... then I get the results I'm expecting.

I suspect that Runstate is one of these string fields that accepts only some kind of structured string (key/value pairs or something like that), but if that is the case then it should at least be documented in the manual.

Geert

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: EA.Element.Runstate setter does not work
« Reply #3 on: August 30, 2018, 03:48:01 pm »
Something like:

Code: [Select]
@VAR;Variable=att1;Value=12;Op==;@ENDVAR;
(Go to an Object/Instance element and press Ctrl+Shift+R, then look in t_object.RunState)
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: EA.Element.Runstate setter does not work
« Reply #4 on: August 30, 2018, 05:11:03 pm »
Something like:

Code: [Select]
@VAR;Variable=att1;Value=12;Op==;@ENDVAR;
(Go to an Object/Instance element and press Ctrl+Shift+R, then look in t_object.RunState)

Any chance to add that info to the documentation?

Thanks

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: EA.Element.Runstate setter does not work
« Reply #5 on: August 30, 2018, 08:23:43 pm »
Exposing Runstate in that way is - well, no words for that. Either you make it accept three parameters (name, operator, value) or you just leave it away since one could directly mangle the database with that format anyway.

q-