IBM Doors DXL: Useful incoming/outgoing Link-Loops and -iterations (inlinks / in-link / out-link / outlinks) and other Iterations through Doors collections

Loop all views in module

Module m=current;
string myView;

for myView in views m do 
{
   print myView "\n";
}

Example: Get all Filter Strings from all views in current Module

Module m=current;
string myView;

for myView in views m do 
{
   print myView "\t";
   View v=view(myView);
   load(m,v);
   Filter f=current;

   if(null f)
   {
	print "no filter\n"
   }
   else
   {
      string filterString=stringOf(m,f);
      print filterString "\n";
   }
}

Loop all attributes on module

Module m=current;
string attribute;
for attribute in m do {
	print attribute "\n";
}

Loop through all In-Links (with Baselines) of an Object

Object obj=current;

Link lnk;
LinkRef lnkRef;
ModName_ otherMod = null;
string linkModuleString;

// I.e. for different Projects with different
// Link-Module Locations
string projName = name(current Project);	
if(projName=="VarCo")
{
  // Links zu Change Request
  linkModuleString = "/VarCo/20 Sample Project/22 Links/Changes"; 
}
else
{
  // Links zu Change Request
  linkModuleString = "/Project/90 Administration/Changes"; 
}
	
int lnkCount=0;
	
Item linkModItem = itemFromID(uniqueID(item(linkModuleString)));
linkModName = fullName(linkModItem);
	
for lnkRef in all(obj<-linkModName) do 
{
  otherMod = module (sourceVersion lnkRef);
  if (!null otherMod) 
  {
    if ((!isDeleted otherMod) && (null data(sourceVersion lnkRef))) 
    {
      load((sourceVersion lnkRef),false);
    }
  }
}
	
for lnk in all(obj<-linkModName) do 
{
  // Get In-Link Object
  Object src = source lnk;
  if ( isDeleted(src) || null(src) ) continue;
	
  identifierCC =  identifier(src) "";
  lnkCount++;
}

Loop through out-links of an object


Object obj=current;

Link lnk;

for lnk in obj->"*" do
{
  string tmn=fullName target(lnk);

  if(!open module tmn)
  {
    read(tmn,false);
  }

  Object tgt = target(lnk);
  print identifier(tgt) "\n";
}

Loop through all (with baselines) out-links of an object

First Approach

Module baselineModul=current;                                         

string satisfiesModuleString = "/NDS/90 Administration/Satisfies";
int object_count=0;
int link_count=0;

Object blObject;    
for blObject in baselineModul do 
{
	// Laufe durch die gebaselinten Outlinks
	Link lnk;
	for lnk in all(blObject->satisfiesModuleString) do
	{
		ModuleVersion mvTarget=targetVersion(lnk);
		if(null data(mvTarget)) 
		{
			load(mvTarget,false);			
		}
		
		Object tgt=target(lnk);
		link_count++;
    }
	 
	 object_count++;
}

print "Link Count: " link_count "\nObject Count: "  object_count "";

Second Approach

Module baselineModul=current;

ModName_ otherMod=null;                                                

string satisfiesModuleString = "/NDS/90 Administration/Satisfies";
int object_count=0;
int link_count=0;

Object blObject;    
for blObject in baselineModul do 
{
    	
	// Laufe durch die gebaselinten Outlinks
	Link lnk;
	for lnk in all(blObject->satisfiesModuleString) do
	{
	  	string tmn=fullName target(lnk);
	  
	  	otherMod = module (targetVersion lnk);
	  	if (!null otherMod) 
	  	{
	   		if ((!isDeleted otherMod) &amp;&amp; (null data(targetVersion lnk))) 
			{
			
				load((targetVersion lnk),false);
			}
	  	}			  
	
	  	Object tgt = target(lnk);
	  	
	  	if(null tgt)
	  	{
		  	print "Is null das Teil!\n";
	  	}
	  	else
	  	{
		  	Baseline blI= baselineInfo(module tgt);
		  	print major(blI) " " minor (blI) "\n";
	  	}
	  	
  		link_count++;
	 }
	 
	 object_count++;
}

print "Link Count: " link_count "\nObject Count: "  object_count "";

Loop through all (with baselines) out-links without opening the target module

Object obj=current;

Link lnk;
for lnk in all(obj->"*") do
{
	ModuleVersion mvTarget=targetVersion(lnk);
	Baseline b = baseline(mvTarget);
	if(!null b)
      {
		// Wenn der Link nicht auf Current geht
		print major(b) "." minor(b) "\n";
      }
	print fullName(mvTarget) " " targetAbsNo(lnk) "\n";
}

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.