I have a SQL stored procedure I call that can return the data with dynamic columns of either the fiscal year or fiscal quarters.
Now, I can get the data to show up when I do this:
foreach ($year in $Fiscalyears) {
$fy = $year.FiscalYear
New-UDTableColumn -Property $fy -Title $fy
}
But, I would like to format the output to be currency:
foreach ($year in $Fiscalyears) {
$fy = $year.FiscalYear
New-UDTableColumn -Property $fy -Title $fy -OnRender {
"{0:C}" -f $EventData.$($fy)
}
}
Unfortunately, that doesn’t work. (I have tried a number of different ways to get that to work. Any ideas on how I can have dynamic columns with an -OnRender?