cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

List of ID's Object when Delete

Solved
Highlighted
Contributor

List of ID's Object when Delete

Hi,

 

Second problem  of the day 😉 

 

I want to edit a list of the HexaIdAbs's objects before deleting them, only for certain kind of object( application,  User Interface Machine, IHM component )

 

Each time I'm deleting objects, I need this list.

 

All this objects  have a specific key-word linked, so it's easier to identify  them:

Different solutions :

- Export by Excel before deleting, but it's quite long , a sheet and a request for one kind of object

- Macro on the deleting event,  writing the list for example in a .csv file but I don't find it for the moment 

-Using  API ( the easier way for me ) 

 

An idea ?

Thanks a lot !

 

Sandrine

 

 

 

 

Tags (2)
6 Replies
Highlighted
MEGA

Re: List of ID's Object when Delete

Hello Sandrine, 

 

do you still have this question ?

 

Lionel

Highlighted
Contributor

Re: List of ID's Object when Delete

Hello Lionel,

 

Yes I still have the  same problem.

For the moment,  I usean API script, it works but it's not easy  use.

 

If you hav a solution for me, i'm ready to take it 😉 

 

thanks,

 

Sandrine

Highlighted
MEGA

Re: List of ID's Object when Delete

Hello Sandrine,

 

could you explain me exactly what you want ?

 

If I understand well, each time you delete an object (any kind of objects or only the ones you mentioned ?) you want a specific list of objects (their _HexaIdAbs) to be edited (Excel file ? Text File ? No matter ?...)

Conveniently, this list would be generated automatically on the "delete" action (as for now you generate it separately) ?

 

Am I right ?

 

Lionel

 

PS : check your private messages 😉

Highlighted
Contributor

Re: List of ID's Object when Delete

Hi Lionel,

 

You're right ! Smiley Wink

 

We have ongoing work to interface  MEGA with HP Quality Center.
We need to identify objects that we suppress in MEGA ( their IDABS) to note them  as obsolete objects in HPQC.
I am the only one who can delete objects. So the easiest would be to trigger a script (or possibly to supply a list) every time I delete, automatic way.

 

Thanks for your help !

 

Highlighted
MEGA

Re: List of ID's Object when Delete

Hello Sandrine,

 

for a single object deletion, there would be no problem to do what you want (we can easily manage the "delete" menu for an object). Unfortunately there is no way, as far as I know, to manage the delete menu on a multiple collection of objects.


But, since you said your objects to delete are connected to a specific keyword, you could run the delete from the keyword menu ! To do so : 

 

Create a metaCommand on the keyword metaclass
Create a macro attached to this metaCommand coded like this (to be adapted to your real need) :

 

Sub CmdInvoke(oKeyword, intCmdNumber)
  Dim oRoot, fso, strFile, myFile, myMode, i
  Dim oObjectToDelete, colObjectsToDelete
Dim strIdCurrentMetaclass, strIdApplication, strIdUIM, strIdIHMC
Set oRoot = oKeyword.getRoot Set fso = CreateObject("Scripting.FileSystemObject") strFile = "C:\Temp\ObjectsToExclude.txt" 'path & name of file where _hexaIdAbs will be written myMode = 8 '2 if you want to overwrite the file each time you delete objects Set myFile = fso.OpenTextFile(strFile, myMode, True)

'Collection des Keywords elements à supprimer Set colObjectsToDelete = oKeyword.getCollection("~QNBAAlJF9bM2[Keyword Element]")
'To delete all objects, and not only one on two
'we start by the end of the collection For i = colObjectsToDelete.count to 1 Step -1 set oObjectToDelete = colObjectsToDelete.Item(i) strIdCurrentMetaclass = oRoot.getObjectFromid(oObjectToDelete.getId).getClassId strIdApplication = oRoot.getObjectFromid("~MrUiM9B5iyM0[Application]").getId strIdUIM = oRoot.getObjectFromid("<Id for the UIM metaclass>").getId strIdIHMC = oRoot.getObjectFromid("<id for the IHMC metaclass>").getId
'_HexaIdAbs are needed only in certain cases... If strIdCurrentMetaclass = strIdApplication OR strIdCurrentMetaclass = strIdUIM OR _
strIdCurrentMetaclass = strIdIHMC Then Call myFile.WriteLine(oObjectToDelete.getProp("~H20000000550[_HexaIdAbs]")) End If
'All objects linked to the keword are deleted...(not only "Application" "UIM" and "IHMC") oObjectToDelete.delete("NOHIERARCHY") Next Set myFile = Nothing Set fso = Nothing End Sub 'If the "Delete" menu must appear only on the specific keyword
'manage it here Sub CmdCheck(mgobjSource, intCmdNumber, intStatusReturned) intStatusReturned = 512 If mgobjSource.getProp("~H20000000550[_HexaIdAbs]") = "<_HexaIdabs of the specific keyword>" Then intStatusReturned = 0 End If End Sub

If it is not what you wanted, just tell me 🙂

 

Lionel

Highlighted
Contributor

Re: List of ID's Object when Delete

Hello,

 

Sorry for the late answer....I was  working on an other project ...

It works perfectly !!!!  Smiley Very Happy

 

Thanks a lot Lionel ,

 

Sandrine