Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The Objective of this code is fetch the Cycle name when user select the specific Releases in Release Combobox.

The code is fetching all the Cycles for a Project in HP ALM rather than on selecting the Release it should fetch the cycle specific to release.

I have tried the below code . Could you please help me fetch the cycle specific to Release selected in HP ALM?

What I have tried:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MetroFramework.Forms;
using MetroFramework;
using TDAPIOLELib;

namespace ALM___Utilities
{
    public partial class Main : MetroForm
    {
        public BugFactory BugF;
        public TDFilter BugFFilter;
        public List BugL;
        public Release rl;
        public Cycle Cyc;
        public CycleFactory CyF;
        public ReleaseFactory rel;
        public List listRel;
        public List listcycle;

        public Main(ITDConnection2 qctd)
        {
            InitializeComponent();
        }

        //private void Export_Defects_Button_Click(object sender, EventArgs e)
        //{
        // BugF = LoginForm.qctd.BugFactory;

        // BugL = (List)BugF.NewList(BugF.Filter.Text);
        //foreach (Bug thisBug in BugL)
        //{

        // string x = thisBug["BG_DETECTED_IN_REL"].Value;
        // }

        private void Main_Load(object sender, EventArgs e)
        {
            Export_Defects_Button.Enabled = false;
            rel = LoginForm.qctd.ReleaseFactory;
            listRel = (List)rel.NewList(rel.Filter.Text);
            Release.Items.Clear();
            foreach (Release rl in listRel)
            {
                Release.Items.Add(rl.Name);
            }
            // CyF = LoginForm.qctd.CycleFactory;
        }

        private void Release_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string releasename = Release.Text;
                listRel = (List)rel.NewList(rel.Filter.Text);
                foreach (Release rl in listRel)
                {
                    CyF = rl.CycleFactory;
                    listcycle = (List)CyF.NewList("");
                    Defect_Cycle.Items.Clear();
                    foreach (TDAPIOLELib.Cycle Cyc in listcycle)
                    {
                        Defect_Cycle.Items.Add(Cyc.Name);
                    }
                }
                Export_Defects_Button.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
Posted
Updated 29-Nov-18 13:46pm
v2

1 solution

You are creating two List objects local to the two methods in your class, so neither is visible to the other. Make your List into a class variable so it exists for the life of the program.
 
Share this answer
 
Comments
[no name] 29-Nov-18 19:44pm    
I have update but still not able fetch the required output
[no name] 29-Nov-18 19:45pm    
Please see the updated code above now?
Richard MacCutchan 30-Nov-18 4:50am    
I do not understand what that code is supposed to be doing. You need to use your debugger to trace what is happening in each stage, especially the loops where you are copying items between lists.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900