Hi!
How can I get the target object of a give outgoing link? I have written this:
myObject = target outGoingLink
If I write as next step a for loop, 'myObject' is the first object in the module in which the foor loop operates and not the object to which points the given link to!
Where is the failure? bandchef - Fri Nov 29 06:36:51 EST 2013 |
Re: How to get the target object?
( You have to ensure that the target module is open in order to avoid the null object as target ...
Object o = current Have fun ! ;) ) |
Re: How to get the target object? pommCannelle - Fri Nov 29 08:15:29 EST 2013
( You have to ensure that the target module is open in order to avoid the null object as target ...
Object o = current Have fun ! ;) )
Object o = current
What do you mean in the last line with "target l"?
My code:
|
Re: How to get the target object? Mhmhmmm. My code don't work und your code also don't work. The objects which where iterated by the last for Loop are beginning with the first object and not with the object the link points to! |
Re: How to get the target object? bandchef - Fri Nov 29 08:29:21 EST 2013 Mhmhmmm. My code don't work und your code also don't work. The objects which where iterated by the last for Loop are beginning with the first object and not with the object the link points to!
( have you tried to replace |
Re: How to get the target object? bandchef - Fri Nov 29 08:29:21 EST 2013 Mhmhmmm. My code don't work und your code also don't work. The objects which where iterated by the last for Loop are beginning with the first object and not with the object the link points to! In this post I once showed the way to properly iterate over the links in a module (which also works with baselines / links to baselines) Here is the cleaned up code with leaks of ModuleVersion removed:
Maybe that helps, regards, Mathias |
Re: How to get the target object? Mathias Mamsch - Sun Dec 01 13:31:12 EST 2013 In this post I once showed the way to properly iterate over the links in a module (which also works with baselines / links to baselines) Here is the cleaned up code with leaks of ModuleVersion removed:
Maybe that helps, regards, Mathias
Hi! Object globalObject
for lnk_InnerOutLink2 in gobj_CurrentObject2 -> * do { //Here, I will get from lnk_InnerOutLink2 the actually object! //globalObject = object(lnk_InnerOutLink2) //e.g. }
Are you understanding my problem? For your Information: The link Points to another Module, which the link comes from! |
Re: How to get the target object? bandchef - Mon Dec 02 08:38:57 EST 2013
Hi! Object globalObject
for lnk_InnerOutLink2 in gobj_CurrentObject2 -> * do { //Here, I will get from lnk_InnerOutLink2 the actually object! //globalObject = object(lnk_InnerOutLink2) //e.g. }
Are you understanding my problem? For your Information: The link Points to another Module, which the link comes from! Yes, so the code I posted is indeed what you need. I just noticed that the link "Object oTgt = target lnk" was still inside a comment (due to the problematic formatting issues from the old posts). So you only need this part:
oTgt is the object you are looking for (target object of the link). o is the object that is the source of the outlink. But the above code is the proper way to iterate over the outlinks of an object, and reliably get a handle to the link target while handling the corner cases (stale links, module deleted, target object is deleted, no access, link goes to baseline, link comes from baseline, ...). Regards, Mathias |
Re: How to get the target object? Mathias Mamsch - Mon Dec 02 09:28:18 EST 2013 Yes, so the code I posted is indeed what you need. I just noticed that the link "Object oTgt = target lnk" was still inside a comment (due to the problematic formatting issues from the old posts). So you only need this part:
oTgt is the object you are looking for (target object of the link). o is the object that is the source of the outlink. But the above code is the proper way to iterate over the outlinks of an object, and reliably get a handle to the link target while handling the corner cases (stale links, module deleted, target object is deleted, no access, link goes to baseline, link comes from baseline, ...). Regards, Mathias Hello Matthias, I have read through your posts and i try something similar in my Doors Module. I want to display the link Path of outgoing amd incoming links in an extra Attribute. For that I made a small progam in DXL : //////////////////////////////////////////////////////////////////////////////////////////
Object o
Link l
string ausgabe
for o in current do {
print "." //Aktivitätsanzeige
//All outgoing links
ausgabe = "" //init
for l in o ->"*" do {
if (ausgabe != ""){ //vor erste Zeile kein \n
ausgabe = ausgabe "\n"
}
//Collect characteristics
ausgabe = ausgabe fullName(target(l)) //Modulname von Target
ausgabe = ausgabe ":" targetAbsNo(l) ""
}
o."Outgoing_Links" = ausgabe
//Alle incoming links
ausgabe = "" //init
for l in o <-"*" do {
if (ausgabe != ""){ //vor erste Zeile kein \n
ausgabe = ausgabe "\n"
}
ausgabe = ausgabe fullName(target(l)) //Modulname von Target
ausgabe = ausgabe ":" targetAbsNo(l) ""
}
o."Incoming_Links" = ausgabe
}
////////////////////////////////////////////////////////////////////////////
For all the outgoing links it works fine, but for the incoming links, the programm just posts the destination path (The collum it is right now, and not the path it comes from) Can someone explaine my mistake to me? I am thankful for any help Thanks Lerates
Für dein Hilfe wäre ich sehr dankbar :) |
Re: How to get the target object? Lerates - Tue Jul 04 01:32:22 EDT 2017 Hello Matthias, I have read through your posts and i try something similar in my Doors Module. I want to display the link Path of outgoing amd incoming links in an extra Attribute. For that I made a small progam in DXL : //////////////////////////////////////////////////////////////////////////////////////////
Object o
Link l
string ausgabe
for o in current do {
print "." //Aktivitätsanzeige
//All outgoing links
ausgabe = "" //init
for l in o ->"*" do {
if (ausgabe != ""){ //vor erste Zeile kein \n
ausgabe = ausgabe "\n"
}
//Collect characteristics
ausgabe = ausgabe fullName(target(l)) //Modulname von Target
ausgabe = ausgabe ":" targetAbsNo(l) ""
}
o."Outgoing_Links" = ausgabe
//Alle incoming links
ausgabe = "" //init
for l in o <-"*" do {
if (ausgabe != ""){ //vor erste Zeile kein \n
ausgabe = ausgabe "\n"
}
ausgabe = ausgabe fullName(target(l)) //Modulname von Target
ausgabe = ausgabe ":" targetAbsNo(l) ""
}
o."Incoming_Links" = ausgabe
}
////////////////////////////////////////////////////////////////////////////
For all the outgoing links it works fine, but for the incoming links, the programm just posts the destination path (The collum it is right now, and not the path it comes from) Can someone explaine my mistake to me? I am thankful for any help Thanks Lerates
Für dein Hilfe wäre ich sehr dankbar :) Why did you not use the code from above? Remember: For an IN-link the "target" that you are using is not the one you are looking for. For inlinks you are interested in the source! Regards, Mathias
|