How to merge two arrays - month and year

I have two arrays -
month={“Jan”, “Feb”, “Mar”, “Apr”, “May”, “Jun”, “Jul”, “Aug”, “Sep”, “Oct”, “Nov”, “Dec”}
year={“2022”, “2023”}

How do I merge them so that the result is -
newArray = {“Jan - 2022”, “Feb - 2022”,…, “Jan - 2023”, “Feb - 2023”}

I would also be happy to have a solution that can give me this combination without defining the month and year arrays as I have defined here.

Hi @gischethans,

If you want use activity check this workflow

Output

Workflow

Append item to collection
image

Thanks,

1 Like

@gischethans

I guess this is what you need

image

System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat.AbbreviatedMonthNames.Take(12).Select(function(x) x+"-2022").Concat(System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat.AbbreviatedMonthNames.Take(12).Select(function(x) x+"-2023"))

Cheers

Hi @gischethans,

What about this

arrYer = {“2022”, “2023”}
arrMon = {“Jan”, “Feb”, “Mar”, “Apr”, “May”, “Jun”, “Jul”, “Aug”, “Sep”, “Oct”, “Nov”, “Dec”}

(From x in arrYer From y in arrMon Let z=x+"-"+y Select(z)).ToArray()

Thanks,

4 Likes

Hi @gischethans ,

Check this workflow for more reference

Thanks,

Hi,

output for the above query
image

That’s correct - I am looking for a solution like this!

But this seems to be of type ‘Object’. How do I get it as an array so that I can use it in subsequent operations?

1 Like

@gischethans

Just use .ToArray at the end

Cheers

1 Like

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