-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support non-object arrays #14
Comments
Implementation(Version 3.4.0 and up) If you join on or more scalar arrays, a scalar array will be return which can be easily used in a $a = 'a1', 'a2', 'a3', 'a4'
$b = 'b1', 'b2', 'b3', 'b4'
$c = 'c1', 'c2', 'c3', 'c4'
$d = 'd1', 'd2', 'd3', 'd4' Example 1: $a |Join $b |Join $c |Join $d |% { "$_" }
# or: foreach ($row in ($a |Join $b |Join $c |Join $d)) { "$Row" }
# or: $a |Join $b |Join $c |Join $d |% { '{0} {1} {2} {3}' -f $_[0], $_[1], $_[2], $_[3] }
a1 b1 c1 d1
a2 b2 c2 d2
a3 b3 c3 d3
a4 b4 c4 d4 Example 2: $a |Join $b |Join $c |Join $d -Name a, b, c, d
a b c d
- - - -
a1 b1 c1 d1
a2 b2 c2 d2
a3 b3 c3 d3
a4 b4 c4 d4 Example 3: $Id = 'a1', 'a2', 'a3', 'a4'
$Department = ConvertFrom-Csv @'
"Name", "Country"
"Engineering", "Germany",
"Marketing", "England",
"Sales", "France",
"Purchase", "France"
'@
$Id |Join $Department
Value Name Country
----- ---- -------
a1 Engineering Germany
a2 Marketing England
a3 Sales France
a4 Purchase France Note that the scalar column will be named |
Implemented in version 3.4.0 |
Especially in a case of a side-by-side joins (where the
-on
parameter is omitted), it would be handy to be able join an array of something that is not an object (meaning anything that doesn't have visual properties like strings and primitives) to an complex (PowerShell) object list, or to another array of non-objects.The text was updated successfully, but these errors were encountered: