06-05-2013 02:18 PM
hello,
I need some help to write a macro to do a laborious work
Here is my problem.
I have some keywords that I Want to transform to Defition objects.
So I have to :
- Create my list of keywords via a request ==> OK
- Catch the name and the comment of each keyword==> OK
- Create an object "Term" with the name of the Keyword==> OK
- Put the comment of the Keyword in the comment of the term==> OK
- Create a definition and attach the previous created term with it, because it's not possible to create directly a Definition ( Without Terme)
- Unbind all the objects of the keyword, and link these objects with the new definition.
Thanks a lot for your help !
Sandrine
My code :
Set oRoot = MegaRoot
Set oMotCleColl = oRoot.getSelection("Select [Mot-Clé] Where [Dossier parent].[Nom court] =""....."")
Set oTermes = oRoot.getcollection("Terme")
Set oDefTermes= oTermes.Item("Définition")
For Each oMotCle in oMotCleColl
oKWComment =oMotCle.GetProp("Comment","object")
oKWName =oMotCle.Name
oTermes.Create oKWName
For Each oTerme in oTermes
if oTerme.Name=oKWName then
oTerme.setProp("Commentaire")=oKWComment
End If
Next
Next
Solved! Go to Solution.
07-05-2013 04:12 PM
Oups... Sorry for the "Severine"...
07-05-2013 04:02 PM
Thanks a lot for the response .
It works perfectly .
Bye
Sandrine
06-05-2013 05:14 PM - edited 06-05-2013 05:14 PM
Hello Severine,
the following code should work if I understand what you want to do :
Set oRoot = MegaRoot Set oMotCleColl = oRoot.getCollection("mot-clé") For Each oMotCle in oMotCleColl oKWComment =oMotCle.GetProp("Comment","object") oKWName =oMotCle.Name Set objFrancais = getObjectFromId("~B0SNPuLckCQ3[Francais]") 'French language in your case Set oNewTerme = objFrancais.getCollection("~WeGnj1jw4PE0[Terme]").Add(oKWName) Set oNewDef = oNewTerme.getCollection("Définition").Create(oKWName) oNewDef.setProp("Commentaire")=oKWComment Set colDefObjects = oNewDef.getCollection("Objet Défini") For each myObj in oMotCle.getCollection("Elément avec mot-clé") Set myNewObjDefinition = colDefObjects.Add(myObj) Next Next
Regards,
Lionel