IBM Doors DXL: How to create a new view with LayoutDXL, Object Text and Object Heading, several attributes

Problem

A new view with the Main-Column (Object Heading and Object Text), a LayoutDXL Attribute and any other attribute shall be created.

Approach

  • Create View from Default View (overwrite existing)
  • Delete all columns in the Default View
  • Insert Columns

Solution

With this script you can iterate over all Attributes you can select for the view:

Module m = current;
string attr;

for attr in m do
{
  print attr "\n";
}

The following script generates the view:

void createViewForModule(Module m, string viewName)
{	
  // construct view of attributes chosen
  Column c;
  int n = 0; // number of existing columns
  int i; // column index
	
  View v = view(viewName);
  bool isLoaded = load(m,v);

  if(!isLoaded)
  {
    // If the view is not existing
    // Save the view
    // Normally the default View 
    // is constructed 	
    // save(m,v) is not asking
    // if a view exists -> it 
    // overwrites any view with
    // the same name	
    save(m,v);
   }		
	
   // count the columns
   for c in m do
   {
      n++; 
   }
	
   // Delete all columns that were
   // contained in the default View
   // used as template
   for(i=1;i<=n;i++)
   {
     delete(column 0); 
   }
	
   // Add Object Identifier (i.e. CRS-CS-2)
   insert(column 0);
   attribute(column 0, "Object Identifier");
   width(column 0, 80);
   justify(column 0, left);
	
    // Add the main Column (Object Heading+
    // Object Text) to the View
    Column mainColumn = null;
    mainColumn = insert mainColumn;
    main mainColumn;
    width(mainColumn, 300);
	
    // Add Object Identifier (i.e. CRS-CS-2)
    insert(column 2);
    attribute(column 2, "BB_ReqStatus");
    width(column 2, 80);	
	
    // Create a LayoutDXL Column in a view
    insert(column 3);  
    // I would recommend to #include scripts
    dxl(column 3, "displayRich \"huhu\""); 
    width(column 3, 80);	

    // important! (last column does not appear
    // otherwise)
    refresh m; 
    save view viewName; 
}

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.

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