Book a Demo

Author Topic: Dumb Question - Trying to get set of all objects  (Read 8866 times)

wikitect

  • EA User
  • **
  • Posts: 117
  • Karma: +2/-0
    • View Profile
    • TRAK Community
Dumb Question - Trying to get set of all objects
« on: March 27, 2010, 12:59:51 am »
I'm trying to do some operations on all the objects in the project.

GetElementSet (string IDList, long Options) looks to be the thing to use (to avoid having to recurse). The words say if no value is specified for IDList then all objects are returned.

What, exactly is the form to use? Have tried empty brackets and an empty pair of string quotes but this clearly isn't right!

Any clues gratefully received!
======
Favourite epitaph: 'Under this sod lies another'

TRAK Framework https://sf.net/p/trak
MDG for TRAK https://sf.net/p/mdgfortrak

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Dumb Question - Trying to get set of all objec
« Reply #1 on: March 27, 2010, 01:17:14 am »
have you tried null?

On another note, are you sure you want ALL objects this way?
That is going to take ages I'm afraid.

Geert

wikitect

  • EA User
  • **
  • Posts: 117
  • Karma: +2/-0
    • View Profile
    • TRAK Community
Re: Dumb Question - Trying to get set of all objec
« Reply #2 on: March 29, 2010, 06:21:56 pm »
Null as in nill entry?  Yes.

I want the set of all objects - if there is another way I'm open to suggestions. The alternative is recursion.

I want to remove old tagged values that are no longer needed but which add to the size of the repository. This is essential house-cleaning and not something that I hope to do very often!
======
Favourite epitaph: 'Under this sod lies another'

TRAK Framework https://sf.net/p/trak
MDG for TRAK https://sf.net/p/mdgfortrak

beginner

  • Guest
Re: Dumb Question - Trying to get set of all objec
« Reply #3 on: March 29, 2010, 06:38:17 pm »
You might consider to use SQLQuery.

b.

wikitect

  • EA User
  • **
  • Posts: 117
  • Karma: +2/-0
    • View Profile
    • TRAK Community
Re: Dumb Question - Trying to get set of all objec
« Reply #4 on: March 29, 2010, 06:44:22 pm »
The problem - certainly using JET - is that it won't support update queries so you can't change values wholesale using SQL.

Given that I know that the delete method in the JScript does the job needed and I only need the form of this 1 instruction to get it to work on the whole project it's probably easier solving this problem rather than a new set caused by the SQL and consistent deletion of tagged value entries.
======
Favourite epitaph: 'Under this sod lies another'

TRAK Framework https://sf.net/p/trak
MDG for TRAK https://sf.net/p/mdgfortrak

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Dumb Question - Trying to get set of all objec
« Reply #5 on: March 29, 2010, 06:45:11 pm »
Yes, in that case you better use an SQL query to only select those with the offending tagged values. (saves you a lot of time having to weed through all objects to find those with the tagged values you are after)
The GetElementSet can also be used with a sql query as input that selects the id's of the elements you are after.

Geert

wikitect

  • EA User
  • **
  • Posts: 117
  • Karma: +2/-0
    • View Profile
    • TRAK Community
Re: Dumb Question - Trying to get set of all objec
« Reply #6 on: March 30, 2010, 07:05:55 pm »
I can see how to execute a query

Code: [Select]
Repository.SQLQuery()
but it wraps everything in XML which isn't what I want. Is there some way to just return the element IDs without the XML?

======
Favourite epitaph: 'Under this sod lies another'

TRAK Framework https://sf.net/p/trak
MDG for TRAK https://sf.net/p/mdgfortrak

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Dumb Question - Trying to get set of all objec
« Reply #7 on: March 30, 2010, 07:24:02 pm »
Read up on the GetElementSet operation.
You can do something like:
Code: [Select]
GetElementSet ("select o.ObjectID from t_object o join t_objectproperties tag where tag.property like 'old_tag_name'", 2)

That should give you a collection of objects with a tag of the given name.

Geert

wikitect

  • EA User
  • **
  • Posts: 117
  • Karma: +2/-0
    • View Profile
    • TRAK Community
Re: Dumb Question - Trying to get set of all objec
« Reply #8 on: March 30, 2010, 07:26:39 pm »
That should do very nicely!  :)

Thanks.
======
Favourite epitaph: 'Under this sod lies another'

TRAK Framework https://sf.net/p/trak
MDG for TRAK https://sf.net/p/mdgfortrak

wikitect

  • EA User
  • **
  • Posts: 117
  • Karma: +2/-0
    • View Profile
    • TRAK Community
Re: Dumb Question - Trying to get set of all objec
« Reply #9 on: March 30, 2010, 07:31:58 pm »
Looking at the official description:

Code: [Select]
2 - Use IDList string as an SQL query to populate this collection.
I didn't get the meaning i.e. that you can use a SQL query to provide the IDList.

The wording could definitely be improved.
======
Favourite epitaph: 'Under this sod lies another'

TRAK Framework https://sf.net/p/trak
MDG for TRAK https://sf.net/p/mdgfortrak

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Dumb Question - Trying to get set of all objec
« Reply #10 on: March 30, 2010, 07:40:52 pm »
Read up on the GetElementSet operation.
You can do something like:
Code: [Select]
GetElementSet ("select o.ObjectID from t_object o join t_objectproperties tag where tag.property like 'old_tag_name'", 2)

That should give you a collection of objects with a tag of the given name.

Geert