Pass output to next step

output from previous step save as
$a=“a:b,c:d”
In next step I want output as
$a=“a:b”,“c:d” how to store output in hash or collection in previous step so that easily split in next step

Hi @himanshuk ,

Thanks for reaching out.

Unfortunately, output variables are pretty basic in their functionality. However, you could achieve what you want by storing the output variable “a:b,c:d” as a string in Step 1, then in a later step take that output variable and store it in a local variable, then run a split function that is a delimiter on commas and create an array that way.

Here is some documentation on output variables so you have quick access to the syntax for the language you’d like to use: Output variables - Octopus Deploy

Please let me know if that helps or if you have any questions.

Best,
Jeremy

Thank you @jeremy.miller I have figure out using simple command, [string []]$a=“a:b,c:d” ; foreach ($b in $a.split(‘,’)){man=$b.split(‘:’)[0]; wom=$b.split(‘:’)[1]}, unfortunately octopus not save output in hash or collection so everytime want to do this exercise

Hi @himanshuk,

Just stepping in for Jeremy while he’s offline, great to hear you’ve managed to get it working by using the split function!

Octopus always treats variables as Dictionary<string,string>, however Octostache (which controls variable filters) does allow for parsing JSON which might be close to what you were after:

Bonus: Setting a project variable to the value of the output variable can save a lot of time:

Let us know if that doesn’t help or you have any questions at all!

Best Regards,

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.