x
login Signup

How can I retrieve a list of projects with a particular tag

I'd like to retrieve a list in a script of projects with a specific tag. I see there exists ectool getProjects but that doesn't return any information containing tags

avatar image By paulbono 39 asked Nov 13, 2013 at 03:30 PM
more ▼
(comments are locked)
10|750 characters needed characters left

2 answers: sort voted first

You can use the findObjects API in the perl script.

Here is a sample code that returns all projects where a property "view" exists. Notice, we only check if the property exists. We ignore its value.

 use strict;
 use ElectricCommander;
 $| = 1;
 
 my $ec = new ElectricCommander();
 
 my $results = $ec->findObjects("project", {
     filter =>     {    propertyName => "view",
                     operator     => "isNotNull"}
                 }    
     );
 
 # extract "projectName" tags from findObjects response
 my $nodes = $results->findnodes("//projectName");
 
 # iterate through all project names and print them out.
 foreach my $node ($nodes->get_nodelist) {
     my $nodeName = $node->string_value();
     print $nodeName . "\n";
 }
avatar image By amalik 16 answered Nov 13, 2013 at 03:48 PM
more ▼
(comments are locked)
avatar image paulbono Nov 13, 2013 at 04:04 PM

Thanks! That pointed me in the right direction.

10|750 characters needed characters left

What if I want to filter the project list by only user created projects and not Electric Cloud created projects that come with ElectricCommander/EFlow?

avatar image By luckyirishlife 59 answered May 03, 2017 at 11:40 PM
more ▼
(comments are locked)
10|750 characters needed characters left
Your answer
toggle preview:

Up to 8 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.