When programmatically opening module views, I need to be able to suppress a warning that appears if an invalid filter is stored as part of the view (that, or pre-validate the view and just not attempt to open it).
Any suggestions, anyone? In a bit of a rush on this one, and absolutely stuck for ideas. noError doesn't address it, because it's not a DXL error...
Screenshot of the error I'm talking about is attached...
Richard_Hesketh - Mon Jul 15 11:50:16 EDT 2013 |
Re: How can I suppress 'invalid filter rules' warning? Hi, It appears like this error is caused by trying to filter for an attribute that is no longer in the module. Two ways to correct this that I know of. 1) Open the view and change the filter to not try and filter on a missing attribute and then save the updated view. 2) Add in criteria to the filter that checks to see if an attribute exists before it is used. if (exists attribute "attribute name") { do filter} Hope this helps, Greg |
Re: How can I suppress 'invalid filter rules' warning? GregM_dxler - Mon Jul 15 13:33:21 EDT 2013 Hi, It appears like this error is caused by trying to filter for an attribute that is no longer in the module. Two ways to correct this that I know of. 1) Open the view and change the filter to not try and filter on a missing attribute and then save the updated view. 2) Add in criteria to the filter that checks to see if an attribute exists before it is used. if (exists attribute "attribute name") { do filter} Hope this helps, Greg Thanks Greg - embarrassingly, I have inadequately stated my requirement! What I need to do is suppress the built-in DOORS warning, which is triggered by existing views, from within my script - I'm trying to do some unattended processing and the message makes that impossible. The rationale is that I have a script that's opening modules and views to catalogue what's in them, and I want it to fail silently if there's a problem with a view. I'm pretty sure I can't pre-validate the view without opening it (and thus triggering the blocking dialogue).
|
Re: How can I suppress 'invalid filter rules' warning? Richard_Hesketh - Tue Jul 16 03:48:31 EDT 2013 Thanks Greg - embarrassingly, I have inadequately stated my requirement! What I need to do is suppress the built-in DOORS warning, which is triggered by existing views, from within my script - I'm trying to do some unattended processing and the message makes that impossible. The rationale is that I have a script that's opening modules and views to catalogue what's in them, and I want it to fail silently if there's a problem with a view. I'm pretty sure I can't pre-validate the view without opening it (and thus triggering the blocking dialogue).
One of the things I find great in this forum is the other points of view. Sometimes I get too narrowed in my thinking of what the answer is, that I forget there might be other ways to solve the problem. If you want to open up modules and list what views are in them, could you just open the modules in the standard view? That shouldn't give you an error message and would allow you to loop through the views. Unfortunately, I don't know of a way to determine what the view consists of (i.e. filtering) without loading the view. Maybe someone else has that knowledge? Greg |
Re: How can I suppress 'invalid filter rules' warning? You can do this by opening the module invisibly. You cannot load a view when the module is not visible, so you have to use the following trick: 1. Open the module invisibly (this suppresses the error if there is one) 2. loop through views in module to get a list of view names. 3. for each view a. use setDefaultViewForUser to set the view as default b. close the module c. open the module d. process the view You can loop through columns etc even if the view is not visible |
Re: How can I suppress 'invalid filter rules' warning? We have also encountered this situation and have not found an automated solution. The best that we could do was to run the script and if the Invalid Filter Dialog appears we would have to save the view manually. Which would eliminate the invalid filter. But, that would also cause us to validate the new filter in case an attribute name may have changed instead of just being deleted.
If there is an automated solution to this I am very interested :) |
Re: How can I suppress 'invalid filter rules' warning? Doug.Zawacki - Wed Jul 17 17:05:52 EDT 2013 We have also encountered this situation and have not found an automated solution. The best that we could do was to run the script and if the Invalid Filter Dialog appears we would have to save the view manually. Which would eliminate the invalid filter. But, that would also cause us to validate the new filter in case an attribute name may have changed instead of just being deleted.
If there is an automated solution to this I am very interested :) Doug, as Richard only wants to catalogue the existing views, needing to validate them should not be needed. But it sounds like your use case is opening the modules for a specific need, e.g. exporting the content of the module to Word. Have you thought about maintaining a "correct" view in one central "template" module and distributing it to all modules before starting the export? For this you can use a "copy views" script, e.g. that from galactic solutions. Of course you would also ensure that the data model of the modules is consistent… HTH Mike |
Re: How can I suppress 'invalid filter rules' warning? Tony's approach sound's great to me. I've had this problem some time ago and wasn't able to find a suitable solution, but using defaultViewForUser seems to work perfectly. Of course it is kind of mad you have to go this way and are not able to simply read out the filter of a view without loading it, but this is DXL :-). Actually this is one of the greatest hacks / workarounds in DXL I've learned for a whole while. @Tony: Thanks a lot! - Michael |
Re: How can I suppress 'invalid filter rules' warning? MichaelGeorg - Thu Jul 18 07:29:14 EDT 2013 Tony's approach sound's great to me. I've had this problem some time ago and wasn't able to find a suitable solution, but using defaultViewForUser seems to work perfectly. Of course it is kind of mad you have to go this way and are not able to simply read out the filter of a view without loading it, but this is DXL :-). Actually this is one of the greatest hacks / workarounds in DXL I've learned for a whole while. @Tony: Thanks a lot! - Michael Mike.Scharnow, You are correct. Our need is specifically trying to validate the views as well as export them on a regular basis. But I do agree that Tony's approach is a good for the perspective that Richard needs. Tony has excellent knowledge and I always learn from him and Mr. Landale and others. This is one of the more helpful forums I've been associated with. Thanks everyone :) |
Re: How can I suppress 'invalid filter rules' warning? Tony_Goodman - Tue Jul 16 09:53:40 EDT 2013 You can do this by opening the module invisibly. You cannot load a view when the module is not visible, so you have to use the following trick: 1. Open the module invisibly (this suppresses the error if there is one) 2. loop through views in module to get a list of view names. 3. for each view a. use setDefaultViewForUser to set the view as default b. close the module c. open the module d. process the view You can loop through columns etc even if the view is not visible Thanks Tony - very well spotted. I'll be using this as the basis of my solution. |
Re: How can I suppress 'invalid filter rules' warning? Tony_Goodman - Tue Jul 16 09:53:40 EDT 2013 You can do this by opening the module invisibly. You cannot load a view when the module is not visible, so you have to use the following trick: 1. Open the module invisibly (this suppresses the error if there is one) 2. loop through views in module to get a list of view names. 3. for each view a. use setDefaultViewForUser to set the view as default b. close the module c. open the module d. process the view You can loop through columns etc even if the view is not visible Thank you for the solution, Tony. This was the last warning that had stopped me from reaching my Automation Goal. |