Programmatically create Views

Hi,

I have a module template DXL script that adds attributes I need when I create a module. I would to be able to create a view, add some columns to it, and make it the default view in that same script. Is this possible?
joeyvitoro - Mon Mar 05 10:20:19 EST 2012

Re: Programmatically create Views
Mathias Mamsch - Mon Mar 05 17:50:16 EST 2012

That is pretty easy:
 

current = mod  // make sure you are working with the right current Module -> mod = Module
 
// delete all column in view
{ int colCount = 0; Column c; for c in mod do colCount++; for (colCount; colCount > 0; colCount--) delete column 0 }
    
{
    // add the columns you want, with the properties you want ....
    Column c 
    int z = 0
    c = insert column z++; attribute(c, "Path"); width (c, 160); title (c, "Path") 
    c = insert column z++; attribute(c, "Full Name"); width (c, 160); title (c, "Full Name") 
    c = insert column z++; main c; width (c, 500); title (c, ""); color (c, "ObjectType")
    c = insert column z++; attribute(c, "Module Template"); width (c, 160); title (c, "Module Template") 
    ....
}
 
{
    // set the view options you want
    autoIndent true   
 
    // save the view under a name (e.g. "Database View") and make it the default view ...
    save (view "Database View", createPublic(mod, true) )
    setDefaultViewForModule(mod, "Database View") 
}

 


Hope that helps, regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: Programmatically create Views
joeyvitoro - Tue Mar 06 16:46:46 EST 2012

Yes, that is exactly what I needed. Thanks!

Re: Programmatically create Views
navrangnaik - Wed Jul 22 02:16:07 EDT 2015

Mathias Mamsch - Mon Mar 05 17:50:16 EST 2012

That is pretty easy:
 

current = mod  // make sure you are working with the right current Module -> mod = Module
 
// delete all column in view
{ int colCount = 0; Column c; for c in mod do colCount++; for (colCount; colCount > 0; colCount--) delete column 0 }
    
{
    // add the columns you want, with the properties you want ....
    Column c 
    int z = 0
    c = insert column z++; attribute(c, "Path"); width (c, 160); title (c, "Path") 
    c = insert column z++; attribute(c, "Full Name"); width (c, 160); title (c, "Full Name") 
    c = insert column z++; main c; width (c, 500); title (c, ""); color (c, "ObjectType")
    c = insert column z++; attribute(c, "Module Template"); width (c, 160); title (c, "Module Template") 
    ....
}
 
{
    // set the view options you want
    autoIndent true   
 
    // save the view under a name (e.g. "Database View") and make it the default view ...
    save (view "Database View", createPublic(mod, true) )
    setDefaultViewForModule(mod, "Database View") 
}

 


Hope that helps, regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Hi Mathias,

 

suppose in same code, if i wanted to create the new view with the current modules view by selecting all objects. how to use the syntax for this.

 

navrang

Re: Programmatically create Views
Mathias Mamsch - Wed Jul 22 03:08:45 EDT 2015

navrangnaik - Wed Jul 22 02:16:07 EDT 2015

Hi Mathias,

 

suppose in same code, if i wanted to create the new view with the current modules view by selecting all objects. how to use the syntax for this.

 

navrang

Can you please clarify what you mean by "create the view ... by selectign all objects"? Do you want to apply a filter? Regards, Mathias

Re: Programmatically create Views
amichler - Wed Jul 26 07:34:02 EDT 2017

Hi

Thanks Mathias for the code above - with it I am able to create view with it from dxl. But I have an extra requirement which I dont know how to solve and hope you can help!

Once I have a view created, from dxl I would like to be able to select the field "Inherit undefined settings from:" and provide a view name from which undefined setting are inherited from. (This setting is under the general tab under manage views).

 

Do you know if this can be done?

 

Thanks

Andrew

 

 

 

Re: Programmatically create Views
Mathias Mamsch - Wed Jul 26 10:19:43 EDT 2017

amichler - Wed Jul 26 07:34:02 EDT 2017

Hi

Thanks Mathias for the code above - with it I am able to create view with it from dxl. But I have an extra requirement which I dont know how to solve and hope you can help!

Once I have a view created, from dxl I would like to be able to select the field "Inherit undefined settings from:" and provide a view name from which undefined setting are inherited from. (This setting is under the general tab under manage views).

 

Do you know if this can be done?

 

Thanks

Andrew

 

 

 

I think what you are looking for are the "setPreloadedView" / "preloadedView" perms ... See DXL Manual, chapter "Views". Regards, Mathias