How to filter defects with ID range in HP ALM C# OTA

395 Views Asked by At

I need to filter the defects for a certain range of ID's from HP ALM using its OTA. This needs to be done without calling all the defects from ALM and filtering them from code as that would significantly increase the time which is not desirable.

For example, I can filter a single defect as follows:

        TDAPIOLELib.BugFactory OBugFactory = alm_core.tDConnection.BugFactory as TDAPIOLELib.BugFactory;
        TDAPIOLELib.TDFilter OTDFilter = OBugFactory.Filter as TDAPIOLELib.TDFilter;
        TDAPIOLELib.List OBugList;
       
        // Gets only the bug with ID 3
        OTDFilter["BG_BUG_ID"] = 3;

        OBugList = OBugFactory.NewList(OTDFilter.Text);
       

Is there a way to get the Bug List in an ID range between 1 to 100. Something like this:

        // Gets all the bugs between 1-100
        OTDFilter["BG_BUG_ID_MIN"] = 1;
        OTDFilter["BG_BUG_ID_MAX"] = 100;

        OBugList = OBugFactory.NewList(OTDFilter.Text);
1

There are 1 best solutions below

0
On BEST ANSWER

The complete solution to filter all the defects between 1-100 is as follows:

TDAPIOLELib.BugFactory OBugFactory = alm_core.tDConnection.BugFactory as TDAPIOLELib.BugFactory;
TDAPIOLELib.TDFilter OTDFilter = OBugFactory.Filter as TDAPIOLELib.TDFilter;
TDAPIOLELib.List OBugList;
List<DefectOutputModel> AllBugList = new List<DefectOutputModel>();
    OTDFilter.Text= @"[Filter]{
                                TableName: BUG,
                                ColumnName: BG_BUG_ID,
                                LogicalFilter: "">= 1 And <= 100"",
                                VisualFilter: "">= 1 And <= 100"",
                                SortOrder: 1,
                                SortDirection: 0,
                                NO_CASE:
                            }";
    OBugList = OBugFactory.NewList(OTDFilter.;

The query for OTDFilter.Text was obtained by first filtering the defects by ID in HP ALM webapp and then copying the filter query text and pasting it here.