question-circle How to query a specific PropertyTable instance on a model element

1 week 3 days ago #5435 by craae
How can you access the specific properties (and its values) related to an model element within a PropertyTable using Jython or alternatively Eclipse?

The "content placeholder" seems to concatenate all the properties and the associated values together in a string which makes it hard to use and operate.

Are you able to somehow fetch the specific PropertyTable by using any of the findBy... methods?

Attachments:

Please Log in or Create an account to join the conversation.

1 week 3 days ago #5436 by cma
Hello,

With Jython you may query a PropertyTable with these methods:
  • String getProperty(String key)
  • java.util.Properties toProperties() toProperties()

To modify a PropertyTable you may use:
  • setProperty(String key, String value)
  • setContent(java.util.Properties newprops)

Don't use String getContent() or setContent(String) .

Please Log in or Create an account to join the conversation.

1 week 3 days ago #5437 by craae
Thanks that works fine - But how would I have found those methods myself?

BTW the getProperty(String key) method doesn't allow key values with spaces. In that case it returns None as result.
Is it possible to have Property keys with spaces included, and still use the getProperty(String key) method?
BR
Claus

Please Log in or Create an account to join the conversation.

5 days 14 hours ago #5440 by craae
As stated earlier the getProperty(string key) returns "None" if the key have one og more spaces included? How if the key internally represented? Are spaces removed or how do I query properties where the key (the property description have spaces included?)
BR
Claus

Please Log in or Create an account to join the conversation.

Moderators: chmcma
Time to create page: 0.141 seconds
^ Back to Top