Loading Filter from a File

I am attempting to load a filter created in DOORS 9.3 from a text file, but I cant find any documentation on how to do this.

Example 

string text = "(Absolute Number <= 2118) AND (Absolute Number >= 2114)"

Filter f = text?

set f;

filtering on;

We are wanting to be able to load these filters from a file so that we can modify some of the conditions of the filter without having to rebuild the entire filter each time, unless there is a better / easier way of doing this?

 

 


lakedoo23 - Fri Feb 13 12:08:31 EST 2015

Re: Loading Filter from a File
O.Wilkop - Wed Feb 18 07:18:42 EST 2015

Even though it is not the greatest one, I have a solution:

Module m = current;

string filterString = "(attribute(\"Absolute Number\") >= \"2114\") && (attribute(\"Absolute Number\") <= \"2118\")"

string code = "";
code = code "Module m = addr_ "((addr_ m) int)";\n";
code = code "current = m;\n";
code = code "Filter f = (" filterString ");\n";
code = code "set f;";

eval_(code)

filtering on

 

We basically interpret the "filterString" as DXL code and use eval_ to execute it. If you use this method you have to make sure that the filterString code is valid DXL code (refer to the "Display control" section in the DXL Reference Manual) and that the code does nothing harmful (so you have to make sure that no one creates a filterString that would delete something). You should probably also make sure to test if the filter is valid (attributes exist etc) or you might run into errors.

Re: Loading Filter from a File
Wolfgang Uhr - Wed Feb 18 08:46:13 EST 2015

Writing Filters from and to a file is not straightforward. You need something like 1K lines of code to analyses the filter itself and the process is something tricky and instable. The main problem is: You only can investigate the filter of the current view and if there is an error in this filter itself your diagnostic scripts allways produces nonsense. There are errors you can detect and there are errors you (or speaken for myself I) cannot detect. So you cannot be shure that your script only produces reliable data.

So actually I think that this is not a good idea.

Best regards

Wolfgang

Re: Loading Filter from a File
EHcnck - Wed Feb 18 08:54:23 EST 2015

Why not just create the filters in a include<file>?

 

e.g.

Filter f1 = attribute "Acceptability" == "Acceptable"

..

..

etc