Answer by paulbono · Nov 25, 2013 at 05:27 PM
I ended up freezing
> use Storable; use Storable qw(nstore > store_fd nstore_fd freeze thaw > dclone); > > my $ec = new ElectricCommander(); > > my @projectMap=([1, 2, 3] [a, b, c]); > my $property = '/myJob/Info'; > $ec->createProperty($property, {propertyType=>'string', value=>pack("u", freeze(\@projectMap))});
and then unfreezing my array
> use Storable; use Storable qw(nstore > store_fd nstore_fd freeze thaw > dclone); > > my $ec = new ElectricCommander(); > > my $temp = > $ec->getProperty("/myJob/Info")->findvalue("//value")->string_value(); > my $tempProjectMap = thaw( unpack( "u", $temp ) ); > my @projectMap = @$tempProjectMap;
Answer by lrochette · Nov 21, 2013 at 09:06 PM
Here is an example of an array stored in a property sheet
use strict; use ElectricCommander; $| = 1; my $ec = new ElectricCommander(); my $totalElements = $ec->getProperty("/myProject/elementCount") ->findnodes("//value") ->string_value(); for (my $i=1 ; $i <= $totalElements ; $i++) { my $element = $ec->getProperty("/myProject/Elements/$i") ->findnodes("//value") ->string_value(); print "$element \n"; }
This will allow to extract under your project, a number of elements and then loop for each entry from 1 to that number in the property sheet named Elements
Answer by sbarry · Nov 22, 2013 at 08:28 AM
Answer by mike westerhof · Nov 21, 2013 at 04:46 PM
Well, you could iterate over each of the individual elements in the array of arrays, and duplicate that structure into a multi-level property sheet structure in Commander... but I found that to be painful and unnecessary if had no need to see or manipulate the individual values outside of Perl.
As it turns out, ec-perl includes the Storable perl module -- so some time ago, I created a couple of perl functions that I use to store and retrieve arbitrary Perl data structures to/from a Commander property.
I put that project on the Electric Cloud community GIT repository, here. The direct download to the project export is here -- save the XML file and import into your Commander server using ectool, something like:
ectool import --file pps_export.xml
You'll probably need administrative permissions to do this, so you may have to ask/beg/bribe your Commander Admin for help if necessary.
How can I print out a property containing a multi line value in an ElectricCommander step? 1 Answer
Best practices for "atomic" modifications to ElectricCommander properties 1 Answer
how to select and delete multiple procedures from a project 1 Answer
What is the easiest way for a job step to set properties on a parent step. 2 Answers
How do we use a property at a workflow as a step's run condition? 2 Answers
Electric Cloud powers Continuous Delivery, helping organizations developing deliver better software faster by automating and accelerating build, test, and deployment processes at scale. Industry leaders like Qualcomm, SpaceX, Cisco, GE, Gap, and E*TRADE use Electric Cloud solutions to boost DevOps productivity and Agile throughput.