Cannot Load View

I am trying to implement a DXL script where I need to open certain modules in a specific view. As per my learning, it is pretty much straightforward and I've tried all that I could. Yet, DXL doesn't load my view.

Just to check whether DXL loads my view, I used a while Loop. Oh yes, you guessed it correct - It hanged!

 

for str in views(m) do{

  if(cistrcmp(str,"DoorsAutomation")==0){

    load view("DoorsAutomation")     //or I can write 'str' here, doesn't change anything

    //work with the module

    //close the module

  }

}

 

'm' is the name of the module that I have currently opened just above these lines.

 

Please help!

Thank you in advance,

Adarsha Kharel.

 


AddKluZiv - Wed Apr 27 08:42:42 EDT 2016

Re: Cannot Load View
DOORSHAM - Wed Apr 27 12:31:51 EDT 2016

Why you won't a script more complex than the following is beyond me?

 

load view("DoorsAutomation")

Re: Cannot Load View
Mike.Scharnow - Wed Apr 27 12:50:55 EDT 2016

DOORSHAM - Wed Apr 27 12:31:51 EDT 2016

Why you won't a script more complex than the following is beyond me?

 

load view("DoorsAutomation")

perhaps because it will silently fail if module m does not have a view "DoorsAutomation"?

Re: Cannot Load View
Mike.Scharnow - Wed Apr 27 13:02:02 EDT 2016

Hi Adarsha,

- did you load m visible?

- is the view's name really "DoorsAutomation" with capital and small letters and spaces?

 

- Don't do this:

for str in views(m) do{

  if(cistrcmp(str,"DoorsAutomation")==0){

    load view("DoorsAutomation")     //or I can write 'str' here, doesn't change anything

    //work with the module

->>>>>>>>>>>    //close the module

  }

}

 

You are in a view that loops over all views of m. If you close m while you are still inside the loop, DOORS will behave unpredictably.

 

And: yes, DOORSHAM is right. you could load the view directly, as the command returns true on success. The availabe perms are

bool load (View)
bool load (Module, View, bool, bool)
bool load (Module, View)
 
bool load (Module, View, bool)

 

Re: Cannot Load View
AddKluZiv - Thu Apr 28 03:19:59 EDT 2016

DOORSHAM - Wed Apr 27 12:31:51 EDT 2016

Why you won't a script more complex than the following is beyond me?

 

load view("DoorsAutomation")

If I just load the view without confirming its existence, then it may not be loaded. So, I need to loop through the available views and check to see if my view is present or not.

Re: Cannot Load View
AddKluZiv - Thu Apr 28 03:46:53 EDT 2016

Mike.Scharnow - Wed Apr 27 13:02:02 EDT 2016

Hi Adarsha,

- did you load m visible?

- is the view's name really "DoorsAutomation" with capital and small letters and spaces?

 

- Don't do this:

for str in views(m) do{

  if(cistrcmp(str,"DoorsAutomation")==0){

    load view("DoorsAutomation")     //or I can write 'str' here, doesn't change anything

    //work with the module

->>>>>>>>>>>    //close the module

  }

}

 

You are in a view that loops over all views of m. If you close m while you are still inside the loop, DOORS will behave unpredictably.

 

And: yes, DOORSHAM is right. you could load the view directly, as the command returns true on success. The availabe perms are

bool load (View)
bool load (Module, View, bool, bool)
bool load (Module, View)
 
bool load (Module, View, bool)

 

m = read(modRefName, true)          //opening the module to read

current = m                                      //Setting the current module to 'm'

...

for str in views(current) do{            //Looping through all the available views in my current module
        if(cistrcmp(str,"DoorsAutomation")==0){     //Checking if there is a view with the Name "DoorsAutomation" available
           flag=1                                                      //If yes, Setting flag to 1 and breaking from the loop
          break
       }
       else flag=0                                                //If no, Setting flag to 0 again. Flag is an integer which is assigned a Default value of 0 at the beginning of this function.
 }
  if(flag==1){                                                    //According to the flag's value, I can now work on my view of the current module, if available.
      load(current,view("DoorsAutomation"))
      //work with current module
      flag=0                                                       //Reset flag to 0 in order to Close the module
 }
      if(flag==0) close current                          //If flag is 0, Close the module. This is required in order to Close all other modules too, which have no view with the Name "DoorsAutomation"

 

 

 

This code, now, is perfectly working fine as per my requirements. It opens the modules and checks to see if my view is there.

By the way, can't we just open the module "invisibly" and then load the view? When I open the modules, there is at least one module which shows "This view contains invalid filter rules ..." as a DOORS Report before opening the module. This makes my Automation impossible. I need to click on the OK button for my script to proceed further. Is there any way to suppress this warning?
 

Re: Cannot Load View
AddKluZiv - Thu Apr 28 04:19:15 EDT 2016

AddKluZiv - Thu Apr 28 03:46:53 EDT 2016

m = read(modRefName, true)          //opening the module to read

current = m                                      //Setting the current module to 'm'

...

for str in views(current) do{            //Looping through all the available views in my current module
        if(cistrcmp(str,"DoorsAutomation")==0){     //Checking if there is a view with the Name "DoorsAutomation" available
           flag=1                                                      //If yes, Setting flag to 1 and breaking from the loop
          break
       }
       else flag=0                                                //If no, Setting flag to 0 again. Flag is an integer which is assigned a Default value of 0 at the beginning of this function.
 }
  if(flag==1){                                                    //According to the flag's value, I can now work on my view of the current module, if available.
      load(current,view("DoorsAutomation"))
      //work with current module
      flag=0                                                       //Reset flag to 0 in order to Close the module
 }
      if(flag==0) close current                          //If flag is 0, Close the module. This is required in order to Close all other modules too, which have no view with the Name "DoorsAutomation"

 

 

 

This code, now, is perfectly working fine as per my requirements. It opens the modules and checks to see if my view is there.

By the way, can't we just open the module "invisibly" and then load the view? When I open the modules, there is at least one module which shows "This view contains invalid filter rules ..." as a DOORS Report before opening the module. This makes my Automation impossible. I need to click on the OK button for my script to proceed further. Is there any way to suppress this warning?
 

It seems I am solving my own problems. LOL.

 

The warning problem was solved using this article:

https://www.ibm.com/developerworks/community/forums/html/topic?id=807171a2-01b8-40ad-a1a9-1bffd86ffc0c#repliesPg=0

 

Thank you guys, for the support.