NEW_ALM12 Outstanding Contributor.
Outstanding Contributor.
416 views

How to get the list of Distinct Domains with the list of project using API or OTA?

Hi Folks, 

I am using below code to connect to ALM instance and get list of Distinct Domains with the list of Projects that are in each domain. BUT, I am getting the Same domain name multiple time in Domain Box and all Projects in Project Box. What I am looking is to have a distinct Domain with the list of project that domain contains in ALM SA... How do I do that? Please see below code snipt and screenshot. 

BTW, I am doing in EXCEL USERFORM. 

Code.PNGExcel_Userform.PNG

0 Likes
9 Replies
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: How to get the list of Distinct Domains with the list of project using API or OTA?

What your code is saying is what you get - for each project, add the domain name to the list in ComboBox1. So you should only add the domain name once, outside the inner for loop.

The weakness of that is that you may get illegal combinations of domain and project. So you should rebuild the project list depending on which domain has been selected.

Alternatively, use a single field where you display a list of pairs of "domain - project".

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
NEW_ALM12 Outstanding Contributor.
Outstanding Contributor.

Re: How to get the list of Distinct Domains with the list of project using API or OTA?

@Jan Czajkowski Jan, thanks for the suggestion. 

Would you please help me sending the code snipet of the your suggestion (Option 1 suggestion)?

0 Likes
NEW_ALM12 Outstanding Contributor.
Outstanding Contributor.

Re: How to get the list of Distinct Domains with the list of project using API or OTA?

I have partial luck on gettig the list. 

1) I am able to get the Non-repeating dmain list. But

2) I am still NOT getting specific project list/s for each domain. 

Please see attached screen shot. It has latest code snipet and scenarios.

Code.PNG

0 Likes
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: How to get the list of Distinct Domains with the list of project using API or OTA?

Here is how you get the project list for each domain:

    For Each dom in domainList 
        For Each proj In tdc.VisibleProjects(dom) ...
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
NEW_ALM12 Outstanding Contributor.
Outstanding Contributor.

Re: How to get the list of Distinct Domains with the list of project using API or OTA?

@Jan Czajkowski and how woudl I fill in ComboBox1_Domain and ComboBox2_Project in Excel Userform? Thats where im not getting.

0 Likes
Highlighted
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: How to get the list of Distinct Domains with the list of project using API or OTA?

Something like this:

Set projectList =  tdc.VisibleProjects(ComboBox1_Domain)
For Each proj in projectList 
     ComboBox2_Project.AddItem proj
Next
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
NEW_ALM12 Outstanding Contributor.
Outstanding Contributor.

Re: How to get the list of Distinct Domains with the list of project using API or OTA?

@Jan Czajkowski Hope Im doing correct per your suggestion. But, Im gettig below error. 

Error is from line in a box.

Code.PNG

0 Likes
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: How to get the list of Distinct Domains with the list of project using API or OTA?

I am not familiar with the syntax but I would assume that ComboBox1_Domain has some "Text" property or similar.

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
NEW_ALM12 Outstanding Contributor.
Outstanding Contributor.

Re: How to get the list of Distinct Domains with the list of project using API or OTA?

I tried with all option I could think of. 

Set projectList = tdc.VisibleProjects(ComboBox1_Domain.Value(dom)) '--> did not work

Set projectList = tdc.VisibleProjects(ComboBox1_Domain.Value = (dom)) '--> did not work

Set projectList = tdc.VisibleProjects(ComboBox1_Domain.AddItem (dom)) '--> did not work

Set projectList = tdc.VisibleProjects(ComboBox1_Domain.Text = (dom))  '--> did not work

 

Instead, if I do as below, 

1) I get all Inactive and Active domain. Domain name is not repeating. THIS IS GOOD Signal. 

2) BUT, In project box I am getting all visible project listed regardless of Domain selected. 

Which is as same my above 2nd screenshot. Im in a circle now.

For Each dom In tdc.DomainsList
     ComboBox1_Domain.AddItem dom
Set projectList = tdc.VisibleProjects(dom)
For Each proj In projectList
        ComboBox2_Project.AddItem proj
    Next proj
Next dom
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.