How to filter tables data in module using DXL?

Hello,

I want to design DXL scripts which get information about links for that i want to design filter which excludes table's linked data before we loop into module, Can anyone suggest me a right filter which excludes table data and just give information about normal requirements?
Also i want the vice versa i.e I want just a table data and excludes data which is apart from table information. 

Thanks in advance


Mayur Chaudhari - Wed Jan 24 03:40:58 EST 2018

Re: How to filter tables data in module using DXL?
Mike.Scharnow - Wed Jan 24 05:00:11 EST 2018

I am not really sure if I understood your requirement, and at the moment, I'm not sure how filters and tables work together, plus linking to tables is always quite tricky when it comes to reports, so, this should be avoided, but to answer your question:

A DOORS table consists of a "table" object, which contains many "row" objects, which contain many "cell" objects. When you have a loop like "for o in entire m do", you can write conditions like "if table(o) || row(o) || cell(o) then { ... do or don't do something with the object ...}"

Re: How to filter tables data in module using DXL?
Mayur Chaudhari - Wed Jan 24 05:19:10 EST 2018

Mike.Scharnow - Wed Jan 24 05:00:11 EST 2018

I am not really sure if I understood your requirement, and at the moment, I'm not sure how filters and tables work together, plus linking to tables is always quite tricky when it comes to reports, so, this should be avoided, but to answer your question:

A DOORS table consists of a "table" object, which contains many "row" objects, which contain many "cell" objects. When you have a loop like "for o in entire m do", you can write conditions like "if table(o) || row(o) || cell(o) then { ... do or don't do something with the object ...}"

For your better understanding what i meant in the previous post was, suppose i have requirements as a normal requirement(i.e not in the form of table) also i have requirements as a table in the same module. I just want to exclude table using filter while i read module's data. Also vice versa can you tell me how to do it?

Thanks 

Re: How to filter tables data in module using DXL?
Mike.Scharnow - Wed Jan 24 05:25:36 EST 2018

Mayur Chaudhari - Wed Jan 24 05:19:10 EST 2018

For your better understanding what i meant in the previous post was, suppose i have requirements as a normal requirement(i.e not in the form of table) also i have requirements as a table in the same module. I just want to exclude table using filter while i read module's data. Also vice versa can you tell me how to do it?

Thanks 

Well, I already did answer your question, didn't I? For every object in your report check whether it belongs to a table or not (using the code I posted) and then proceed in your script accordingly.

Re: How to filter tables data in module using DXL?
Mayur Chaudhari - Wed Jan 24 09:21:32 EST 2018

Mike.Scharnow - Wed Jan 24 05:25:36 EST 2018

Well, I already did answer your question, didn't I? For every object in your report check whether it belongs to a table or not (using the code I posted) and then proceed in your script accordingly.

As you told me about cell and rows of the table, I just want to simply avoid whole table and take out rest of the data, can i do that using DXL?

e.g Filter f=exclude(whole table) something like this or you suggest me any filter like this.

 

Re: How to filter tables data in module using DXL?
Mike.Scharnow - Wed Jan 24 09:52:04 EST 2018

Mayur Chaudhari - Wed Jan 24 09:21:32 EST 2018

As you told me about cell and rows of the table, I just want to simply avoid whole table and take out rest of the data, can i do that using DXL?

e.g Filter f=exclude(whole table) something like this or you suggest me any filter like this.

 

Work with accept and reject. See the example program in the DXL manual on page 651

Re: How to filter tables data in module using DXL?
Mike.Scharnow - Wed Jan 24 10:06:43 EST 2018

what I still don't understand is the requirement for this that you stated in your first line of your question " i want to design filter which excludes table's linked data before we loop into module". What do you mean by "loop into module"? Do you want to write a script that 

- first goes through the complete module and defines whether the object is table related or not

- then work through the complete module again using the not-filtered objects

- delete the filter again

so that the user does not see the filter at all, it is just for the script?

 

In this case: why would you want to do this? I do not see any advantage. Certainly your script will run slower than using the construction

bool bTreatTables = true   

if (whatever you do, perhaps in a loop) then bTreatTables = false


void somefunction (bool bModifyTableObjects, Module m) {
   Object o
   for entire o in m do {
          bool bIsTableObject = table(o) || row(o) || cell(o);
          if (bModifyTableObjects &&  !bIsTableObject ) || (!bModifyTableObjects && !bIsTableObject) then continue
          if (further criteria for skipping the object, e.g. isDeleted(o)) then continue
          
          ... treat your object ...
   }
}

Module M = xyz
somefunction (bTreatTables, M, ...)

 

Re: How to filter tables data in module using DXL?
Mayur Chaudhari - Thu Jan 25 02:03:00 EST 2018

Mike.Scharnow - Wed Jan 24 10:06:43 EST 2018

what I still don't understand is the requirement for this that you stated in your first line of your question " i want to design filter which excludes table's linked data before we loop into module". What do you mean by "loop into module"? Do you want to write a script that 

- first goes through the complete module and defines whether the object is table related or not

- then work through the complete module again using the not-filtered objects

- delete the filter again

so that the user does not see the filter at all, it is just for the script?

 

In this case: why would you want to do this? I do not see any advantage. Certainly your script will run slower than using the construction

bool bTreatTables = true   

if (whatever you do, perhaps in a loop) then bTreatTables = false


void somefunction (bool bModifyTableObjects, Module m) {
   Object o
   for entire o in m do {
          bool bIsTableObject = table(o) || row(o) || cell(o);
          if (bModifyTableObjects &&  !bIsTableObject ) || (!bModifyTableObjects && !bIsTableObject) then continue
          if (further criteria for skipping the object, e.g. isDeleted(o)) then continue
          
          ... treat your object ...
   }
}

Module M = xyz
somefunction (bTreatTables, M, ...)

 

Thanks for the reply Mike,I will elaborate my requirement.

Scenarios:-

1) I have one module which consist of different requirements like i have tables and normal requirements(non table requirements).

2) I want to design a filter which gives me only table requirements but before iterating through module requirements

    i.e Filter f=("condition to filter tables")    //  This the condition i want

         set filter

         filtering on

        for obj in module do

      {

          code to print all requirements which are  in the form of tables

        i.e print only  table requirements

         

     }

 

Re: How to filter tables data in module using DXL?
PekkaMakinen - Thu Jan 25 02:33:57 EST 2018

Mayur Chaudhari - Thu Jan 25 02:03:00 EST 2018

Thanks for the reply Mike,I will elaborate my requirement.

Scenarios:-

1) I have one module which consist of different requirements like i have tables and normal requirements(non table requirements).

2) I want to design a filter which gives me only table requirements but before iterating through module requirements

    i.e Filter f=("condition to filter tables")    //  This the condition i want

         set filter

         filtering on

        for obj in module do

      {

          code to print all requirements which are  in the form of tables

        i.e print only  table requirements

         

     }

 

And with the word "table" you mean a DOORS native table? Which tables are created in a module by Table / Insert or by importing a Word document with Word tables?

Re: How to filter tables data in module using DXL?
Mayur Chaudhari - Thu Jan 25 04:00:13 EST 2018

PekkaMakinen - Thu Jan 25 02:33:57 EST 2018

And with the word "table" you mean a DOORS native table? Which tables are created in a module by Table / Insert or by importing a Word document with Word tables?

Table i mean native table of doors.Which we can insert in rational doors by going to Table->Insert->(after or below).

Re: How to filter tables data in module using DXL?
Mike.Scharnow - Thu Jan 25 04:28:27 EST 2018

Mayur Chaudhari - Thu Jan 25 02:03:00 EST 2018

Thanks for the reply Mike,I will elaborate my requirement.

Scenarios:-

1) I have one module which consist of different requirements like i have tables and normal requirements(non table requirements).

2) I want to design a filter which gives me only table requirements but before iterating through module requirements

    i.e Filter f=("condition to filter tables")    //  This the condition i want

         set filter

         filtering on

        for obj in module do

      {

          code to print all requirements which are  in the form of tables

        i.e print only  table requirements

         

     }

 

I would say there is no such thing, at least not know how to implement this.

So, to create a filter you would have to traverse all objects and decide whether they shall be rejected or accepted.

I still do not understand why you need such a filter at all. Certainly it would not speed up your script. I think I said this somewhere else already: even if there was such a magic only-tables-filter, DOORS would still internally load ALL objects and internally do something like "oh, this object is supposed to be filtered, I'll discard it and proceed with the next" - the same thing you would do with the code I suggested.

So, in my opinion, your requirement cannot really be achieved with DOORS except by itterating twice over all objects, and this would not speed up your script.

 

If you have problems with the run time of your script, perhaps there are other problems which slow down the execution....

Re: How to filter tables data in module using DXL?
Mayur Chaudhari - Thu Jan 25 05:36:02 EST 2018

Mike.Scharnow - Thu Jan 25 04:28:27 EST 2018

I would say there is no such thing, at least not know how to implement this.

So, to create a filter you would have to traverse all objects and decide whether they shall be rejected or accepted.

I still do not understand why you need such a filter at all. Certainly it would not speed up your script. I think I said this somewhere else already: even if there was such a magic only-tables-filter, DOORS would still internally load ALL objects and internally do something like "oh, this object is supposed to be filtered, I'll discard it and proceed with the next" - the same thing you would do with the code I suggested.

So, in my opinion, your requirement cannot really be achieved with DOORS except by itterating twice over all objects, and this would not speed up your script.

 

If you have problems with the run time of your script, perhaps there are other problems which slow down the execution....

Thanks for the reply mike.

The sole purpose of the filter script is to reduce execution time. Currently if i want to get table objects i have to traverse through every object of the module and accept only table objects. If there had been a filter which would give me only table object it would save my time of traversing through every object of module. But as you have suggested that internally Doors would traverse through every object (if this kind of filter would be already existing in Doors) then it will not help me improve execution time.

e.g Filter f= attribute "Last Modified On" > givenTime    //given time is the time provided by user

-This filter gives me objects which are modified after givenTime. Does this filter internally traverse through every object of module and gets only the objects which are modified after given date? If this is the case user can also develope similar kind of DXL script.

If we compare our developed script with the existing filter of doors, would there be any difference in execution time of both?

 

 

Re: How to filter tables data in module using DXL?
Mike.Scharnow - Thu Jan 25 06:18:12 EST 2018

I do not really know the internal processes of DOORS, but I know that DOORS is very client orientated. When you open a module, the complete module will be retrieved from the server. So, a filter will always have to "look" at every object when you do a loop "for o in m do" (as opposed to "for o in entire m do"). Whether the "internal" filter mechanism is faster than the "external" filter mechanism (via a user DXL script), I have not measured, (feel free to do so for your specific module, remember that the time to "Apply" the filter has to be added to the execution time), but I don't think there is much difference. "Last Modified On" should not be faster, but DOORS surprises me often enough.

 

Still I think, if your script is too slow, you probably have other means to speed it up (look at string tables, un-freed objects, print commands, other IO related parts of the script). 
If everything is still slow after speeding up your script you might want to check whether you can split up your module into smaller parts. How many thousands of objects are we talking about here and how long is the execution time? Look at the forum, there are a lot of threads about reducing execution time in DXL