Filtering on DXL attribute

Is it possible to use a DXL attribute in filtering?

Does the filtering run first or the recalculation of the attribute?

If the filtering runs before the recalculation, then my construct can't work!

If the calculation of the attribute runs before the filtering, then I wonder, why my construct does not work :-(


thsturm - Mon Apr 13 11:07:54 EDT 2015

Re: Filtering on DXL attribute
Wolfgang Uhr - Tue Apr 14 03:41:11 EDT 2015

Ok, let us see:

  1. The recalculation of an dxl-attribute is triggered if the view is loaded, which just included this attributes. This can easily be seen if you have some attributes having a time consuming recalculation process. This time consuming process is never used unless the attributes are used. Here I assume, that only those object attributes are recalculated which are visible in the view.
  2. The view itself loads its loads the set of columns, which are stored in the view and then it filters the objects, which shall be shown in the view.

> If the calculation of the attribute runs before the filtering, then I wonder, why my construct does not work :-(

I think your worst fear is just standing up to you. You can check this out by doing the following.

a) Include a time consuming loop in your dxl code, may be some calculation or a wait for 1 second.

b) Load a view which shows all obects (unfiltered) and the relevant dxl-attributes.

b) Load your specific filtered view.

If the time cosuming process is the selection of the first view and after this b holds the correct values, you are right. In this case you can only use thoose attributes in unfiltered views.

Best reagards

Wolfgang

Re: Filtering on DXL attribute
thsturm - Wed Apr 15 06:11:39 EDT 2015

I have created two views: "Filter" with the filtering enabled, and "NoFilter" with the filtering disabled.

Each view has the same two columns with DXL attribute. The filter shows only objects, with are not empty in these columns.

1. open Module, show "Filter" view: all attributes are computed and correct filtered. Changing the view does not recompute the attributes.

2. open Module, show "NoFilter" view: all attributes are computed and alle objects are shown. Changing the view does not recompute the attributes.

How else can I check, what comes first: filtering or computing the value?

Re: Filtering on DXL attribute
Wolfgang Uhr - Wed Apr 15 06:50:49 EDT 2015

thsturm - Wed Apr 15 06:11:39 EDT 2015

I have created two views: "Filter" with the filtering enabled, and "NoFilter" with the filtering disabled.

Each view has the same two columns with DXL attribute. The filter shows only objects, with are not empty in these columns.

1. open Module, show "Filter" view: all attributes are computed and correct filtered. Changing the view does not recompute the attributes.

2. open Module, show "NoFilter" view: all attributes are computed and alle objects are shown. Changing the view does not recompute the attributes.

How else can I check, what comes first: filtering or computing the value?

Sorry, I've forgotten in the first place. You can refresh the dxl-attribute calculation

http://www-01.ibm.com/support/docview.wss?uid=swg21406489

I beg your pardon, but I do not use this routine frequently.

Re: Filtering on DXL attribute
Mathias Mamsch - Wed Apr 15 06:54:35 EDT 2015

thsturm - Wed Apr 15 06:11:39 EDT 2015

I have created two views: "Filter" with the filtering enabled, and "NoFilter" with the filtering disabled.

Each view has the same two columns with DXL attribute. The filter shows only objects, with are not empty in these columns.

1. open Module, show "Filter" view: all attributes are computed and correct filtered. Changing the view does not recompute the attributes.

2. open Module, show "NoFilter" view: all attributes are computed and alle objects are shown. Changing the view does not recompute the attributes.

How else can I check, what comes first: filtering or computing the value?

I think you are mixing stuff up here. Calculation of a DXL attribute occurs as far as I know under two conditions:

1. The attribute value is accessed the FIRST time.

2. The attribute value is reset to NULL. In this case recalculation is immediate.

(there is of course an exception. DXL attributes that are 'module' + 'object' type will also be calculated when opening the module under some cases)

So of course filtering a DXL attribute will need to access its values, and therefore should trigger initial calculation of the DXL attribute. After that the value will not be recalculated - if you change the view or not, filter or not, unless you Refresh the module or use the "Refresh DXL attributes" tool (which will again assign null values to all objects, all DXL attributes).

Any different behaviour would make not a lot of sense to me. Please validate. As long as you do not do any fancy stuff in your DXL attribute (e.g. calculate the value dependent on the current fitlered objects, or some such) you should have no problems.

Regards, Mathias

Re: Filtering on DXL attribute
thsturm - Wed Apr 15 08:50:32 EDT 2015

I have:

  • a view with two columns with (different) DXL attributes
  • a filter, that only shows objects which have a value (e.g. are not empty) in any of the two columns
  • the view has filtering enabled

If I open the module and go to the view, the view content is not correct, i.e. some objects are not shown.

Now: disable filtering, recalculate DXL attribs, enable filtering and the correct objects are shown.

Therfore the question: does the filtering occur before the calucation? (no value > no display > no calculation)

 

Re: Filtering on DXL attribute
Mathias Mamsch - Wed Apr 15 10:26:58 EDT 2015

thsturm - Wed Apr 15 08:50:32 EDT 2015

I have:

  • a view with two columns with (different) DXL attributes
  • a filter, that only shows objects which have a value (e.g. are not empty) in any of the two columns
  • the view has filtering enabled

If I open the module and go to the view, the view content is not correct, i.e. some objects are not shown.

Now: disable filtering, recalculate DXL attribs, enable filtering and the correct objects are shown.

Therfore the question: does the filtering occur before the calucation? (no value > no display > no calculation)

 

Filtering needs to occur AFTER calculation, otherwise it would make no sense.

What I tried to say is, you could produce the effect you are describing by making some "fancy" attribute DXL code.

Try to do the following:

1. Create a new module.

2. Create 50 Objects inside the module.

3. Create a DXL attribute "Attr1" with the following code:

int nr = obj."Absolute Number"
if (nr % 2 == 0) obj.attrDXLName = "Output"

4. Set a filter "Attr1 is not empty". Save the view inside the module with filtering active as the default module view.

5. Close the module and reopen it.

You should see the correctly filtered list of all objects with square Absolute Numbers. So the attribute DXL values are correctly processed before filtering.

There are only two reasons why I can imagine this to fail:

  1. Your DXL attributes are not properly coded, so they do not give the same value on first calculation and the refresh
  2. You are experiencing a DOORS Client bug.

It should be easy to test: Just insert a print statement, at the end of the DXL attribute:

print "DXL Attribute '" attrDXLName "' for Object " (obj."Absolute Number") " calculation.\n"

You should get a print statement for every object. If not you got a DOORS client bug. If so, and the behaviour is as you described you should suffer from a weird DXL attribute code.

Hope that helps, regards, Mathias

Re: Filtering on DXL attribute
Mathias Mamsch - Wed Apr 15 10:35:32 EDT 2015

Mathias Mamsch - Wed Apr 15 10:26:58 EDT 2015

Filtering needs to occur AFTER calculation, otherwise it would make no sense.

What I tried to say is, you could produce the effect you are describing by making some "fancy" attribute DXL code.

Try to do the following:

1. Create a new module.

2. Create 50 Objects inside the module.

3. Create a DXL attribute "Attr1" with the following code:

int nr = obj."Absolute Number"
if (nr % 2 == 0) obj.attrDXLName = "Output"

4. Set a filter "Attr1 is not empty". Save the view inside the module with filtering active as the default module view.

5. Close the module and reopen it.

You should see the correctly filtered list of all objects with square Absolute Numbers. So the attribute DXL values are correctly processed before filtering.

There are only two reasons why I can imagine this to fail:

  1. Your DXL attributes are not properly coded, so they do not give the same value on first calculation and the refresh
  2. You are experiencing a DOORS Client bug.

It should be easy to test: Just insert a print statement, at the end of the DXL attribute:

print "DXL Attribute '" attrDXLName "' for Object " (obj."Absolute Number") " calculation.\n"

You should get a print statement for every object. If not you got a DOORS client bug. If so, and the behaviour is as you described you should suffer from a weird DXL attribute code.

Hope that helps, regards, Mathias

by the way: the term "fancy" code I borrowed from Louie and it describes something, that is DXL code, which tries to do stuff, for which DXL was not intended for and normally can be achieved a little differently in a safe way.

For DXL attributes, "fancy" stuff includes for me:

  • Different DXL attributes that depend on each other (and read their values).
  • A DXL attribute that reads its own values for a different object.
  • A DXL attribute that calculates based on the settings of the current view, or something like that.

So until I do not know what your DXL attributes are doing, I would suspect that the effect you are describing comes from "fancy" code. Less likely it could also be a DOORS bug.

Regards, Mathias

Re: Filtering on DXL attribute
thsturm - Mon Apr 20 08:38:54 EDT 2015

Mathias Mamsch - Wed Apr 15 10:35:32 EDT 2015

by the way: the term "fancy" code I borrowed from Louie and it describes something, that is DXL code, which tries to do stuff, for which DXL was not intended for and normally can be achieved a little differently in a safe way.

For DXL attributes, "fancy" stuff includes for me:

  • Different DXL attributes that depend on each other (and read their values).
  • A DXL attribute that reads its own values for a different object.
  • A DXL attribute that calculates based on the settings of the current view, or something like that.

So until I do not know what your DXL attributes are doing, I would suspect that the effect you are describing comes from "fancy" code. Less likely it could also be a DOORS bug.

Regards, Mathias

Hello Mathias,

some objects, no filter, 'Refesh DXL Attributes', output from the DXL window:

DXL Attribute 'Attrib1' for Object 6 calcutalion.
DXL Attribute 'Attrib1' for Object 1 calcutalion.
DXL Attribute 'Attrib1' for Object 5 calcutalion.
DXL Attribute 'Attrib1' for Object 7 calcutalion.
DXL Attribute 'Attrib1' for Object 2 calcutalion.
DXL Attribute 'Attrib1' for Object 8 calcutalion.
DXL Attribute 'Attrib1' for Object 9 calcutalion.
DXL Attribute 'Attrib1' for Object 10 calcutalion.
DXL Attribute 'Attrib1' for Object 3 calcutalion.
DXL Attribute 'Attrib1' for Object 11 calcutalion.
DXL Attribute 'Attrib1' for Object 12 calcutalion.
DXL Attribute 'Attrib1' for Object 13 calcutalion.
DXL Attribute 'Attrib1' for Object 4 calcutalion.
DXL Attribute 'Attrib1' for Object 14 calcutalion.

same objects, with filter: "'Attrib1' not empty" , 'Refesh DXL Attributes', output from the DXL window:

DXL Attribute 'Attrib1' for Object 6 calcutalion.
DXL Attribute 'Attrib1' for Object 2 calcutalion.
DXL Attribute 'Attrib1' for Object 8 calcutalion.
DXL Attribute 'Attrib1' for Object 10 calcutalion.
DXL Attribute 'Attrib1' for Object 12 calcutalion.
DXL Attribute 'Attrib1' for Object 4 calcutalion.
DXL Attribute 'Attrib1' for Object 14 calcutalion.

???

It seams, that filtering and calculating of attributes values are intermingled.

I had also expected first calculation and than filtering.

Thank you for the idea with 'print'!

Re: Filtering on DXL attribute
Mathias Mamsch - Mon Apr 20 10:04:48 EDT 2015

thsturm - Mon Apr 20 08:38:54 EDT 2015

Hello Mathias,

some objects, no filter, 'Refesh DXL Attributes', output from the DXL window:

DXL Attribute 'Attrib1' for Object 6 calcutalion.
DXL Attribute 'Attrib1' for Object 1 calcutalion.
DXL Attribute 'Attrib1' for Object 5 calcutalion.
DXL Attribute 'Attrib1' for Object 7 calcutalion.
DXL Attribute 'Attrib1' for Object 2 calcutalion.
DXL Attribute 'Attrib1' for Object 8 calcutalion.
DXL Attribute 'Attrib1' for Object 9 calcutalion.
DXL Attribute 'Attrib1' for Object 10 calcutalion.
DXL Attribute 'Attrib1' for Object 3 calcutalion.
DXL Attribute 'Attrib1' for Object 11 calcutalion.
DXL Attribute 'Attrib1' for Object 12 calcutalion.
DXL Attribute 'Attrib1' for Object 13 calcutalion.
DXL Attribute 'Attrib1' for Object 4 calcutalion.
DXL Attribute 'Attrib1' for Object 14 calcutalion.

same objects, with filter: "'Attrib1' not empty" , 'Refesh DXL Attributes', output from the DXL window:

DXL Attribute 'Attrib1' for Object 6 calcutalion.
DXL Attribute 'Attrib1' for Object 2 calcutalion.
DXL Attribute 'Attrib1' for Object 8 calcutalion.
DXL Attribute 'Attrib1' for Object 10 calcutalion.
DXL Attribute 'Attrib1' for Object 12 calcutalion.
DXL Attribute 'Attrib1' for Object 4 calcutalion.
DXL Attribute 'Attrib1' for Object 14 calcutalion.

???

It seams, that filtering and calculating of attributes values are intermingled.

I had also expected first calculation and than filtering.

Thank you for the idea with 'print'!

The problem seems to be the "Refresh DXL Attributes" skript, rather than the filtering / calculation behaviour.

Try the following. With active filter, execute the following code:

Object o; for o in entire current Module do o."Attr1" = null

which will reset the DXL attribute values for the complete module. Then refresh the filter. You will get a recalculation for all objects.

If you use the "Refresh DXL attributes" you only get recalculation for the filtered objects. So it seems you need an alternative for the "Refresh DXL attributes".

Regards, Mathias

Re: Filtering on DXL attribute
thsturm - Wed Apr 22 04:10:02 EDT 2015

Mathias Mamsch - Mon Apr 20 10:04:48 EDT 2015

The problem seems to be the "Refresh DXL Attributes" skript, rather than the filtering / calculation behaviour.

Try the following. With active filter, execute the following code:

Object o; for o in entire current Module do o."Attr1" = null

which will reset the DXL attribute values for the complete module. Then refresh the filter. You will get a recalculation for all objects.

If you use the "Refresh DXL attributes" you only get recalculation for the filtered objects. So it seems you need an alternative for the "Refresh DXL attributes".

Regards, Mathias

I close the topic with the following observation:

  • open the module and than changing the view will compute the value for all objects
  • 'Tools > Refresh DXL Attributes' will only recompute the value only for filtered objetcs

Setting an attribute to 'null' will also recompute the value of the object.