pharnos
February 23, 2022, 2:31am
1
Product: PowerShell Universal
Version: 2.8.1
Is something like this possible? I want to output the results of a SQL query but join 2 columns into 1 column in the UDTable.
For example, the SQL result contains 3 columns
And I’d like to create a New-UDTable with 2 columns
Id (Id from the SQL result)
Name (FirstName + LastName from the SQL result)
Not too sure how to accomplish that, anyone have a hint?
Cheers!
Steve.
dkkazak
February 23, 2022, 3:38pm
2
I’d just recommend that you do that in your SQL query where you join the two tables together.
pharnos
February 23, 2022, 6:40pm
3
Hmm yeah I could alter the SQL query to something like:
SELECT Id,
FirstName,
LastName,
CONCAT(FirstName, ' ', LastName) AS Name
FROM People
Not ideal, but if better than manipulating the System.Data.DataRow that is returned then I can get some changes made to the SQL query.
Thanks for the reply @dkkazak !
dkkazak
February 24, 2022, 5:09am
4
I guess another way you could do this is with your column:
New-UDTableColumn -Property FirstName -Title “Name” -Render {
$Name = $($EventData.Firstname) + " " + $($EventData.LastName)
$Name
}
1 Like